Merge lp:~vila/bzr/832036-stack-registry into lp:bzr
Status: | Rejected |
---|---|
Rejected by: | Vincent Ladeuil |
Proposed branch: | lp:~vila/bzr/832036-stack-registry |
Merge into: | lp:bzr |
Diff against target: |
563 lines (+201/-89) 18 files modified
bzrlib/bzrdir.py (+1/-1) bzrlib/config.py (+103/-57) bzrlib/debug.py (+1/-1) bzrlib/dirstate.py (+3/-4) bzrlib/i18n.py (+1/-1) bzrlib/library_state.py (+2/-3) bzrlib/lockdir.py (+1/-1) bzrlib/msgeditor.py (+1/-1) bzrlib/osutils.py (+1/-1) bzrlib/repofmt/pack_repo.py (+1/-1) bzrlib/tests/per_workingtree/test_workingtree.py (+2/-2) bzrlib/tests/test_config.py (+54/-7) bzrlib/tests/test_debug.py (+1/-1) bzrlib/tests/test_selftest.py (+1/-1) bzrlib/ui/__init__.py (+1/-1) bzrlib/workingtree_4.py (+1/-1) doc/developers/configuration.txt (+23/-5) doc/en/release-notes/bzr-2.5.txt (+3/-0) |
To merge this branch: | bzr merge lp:~vila/bzr/832036-stack-registry |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Martin Pool | Needs Information | ||
Jelmer Vernooij (community) | Needs Information | ||
Review via email: mp+74366@code.launchpad.net |
Description of the change
This introduces a stack registry (config.stacks) needed to:
- get a single point where stacks are obtained,
- allow plugins to override/enrich the stacks or add their own ones.
The registry really provides stack *factories*, each factory
defining its own context which callers should provide via the
parameters.
I've replaced the *Stack classes with their moral equivalent as
factories (suggested by Martin in a previous review).
I first implemented the registry so that the callers use:
- c = config.
+ c = config.
- return config.
+ return config.
But I then switched to:
- c = config.
+ c = config.
- return config.
+ return config.
which avoid the additional () and should be easier to use and let
the caller focus on getting a stack, not on implementation
details (i.e. *how* the stack is built is of little interest to
the caller as long as he get the right stack).
There is still one piece missing here: a way to centralize access
to the stores so we can guarantee unique reads/writes. This
registry will make it easier to pass some info to the factories
to get these stores.
I'm not sold on the factory signatures, Martin mentioned using a
dict (instead of args in the current implementation), that may be
better. In fact, turning these args into a dict will allow
injecting the store access means to all factories (i.e. 'stores'
or 'possible_stores' object can be passed from the registry in
this dict and will provide a single access point to get Store
objects shared across all stacks but this is probably better
addressed as a separate mp)...
I've fixed a small bug in the OptionRegistry where the option
help was acquired at registration, only to be ignored in
get_help(). The same attribute is used in both cases so there is
no point in acquiring it at registration.
Known issues not addressed here but IMHO not strictly required to
consider bug #832036 fixed:
* composing specific stacks should be easier and the mandatory
parts should be reusable (option values from the command-line
should be respected by all stacks (or not ? do we really want
to allow this feature for 'control-only' which defines only
'default_
* the stack registry is not yet plugged into the library state (I
need some teddy bear to discuss how this should work though).
Unmerged revisions
- 6129. By Vincent Ladeuil
-
Implement a config stack registry and use it.
- 6128. By Vincent Ladeuil
-
Make config.stacks.get() build the stack and accept context parameters but _get_factory for tests and unforeseen uses.
- 6127. By Vincent Ladeuil
-
Introduce a stack factory registry and use it instead of the *Stack classses (now deleted).
- 6126. By Vincent Ladeuil
-
Implements a stack registry with basic tests.
- 6125. By Canonical.com Patch Queue Manager <email address hidden>
-
(jelmer) Mention the number of tags that was pushed/pull,
if any. (Jelmer Vernooij) - 6124. By Canonical.com Patch Queue Manager <email address hidden>
-
(jelmer) Add a ``bugtracker`` configuration option. (Jelmer Vernooij)
Can you explain a bit what the stacks make possible, and what use cases they cover? I don't really understand why this all needs to be in a registry rather than e.g. just having the relevant context objects provide their own stack (Branch. get_config_ stack() ?), like we do for config at the moment.