Rev 6077: Add the missing config stacks and store in file:///home/vila/src/bzr/experimental/stack-registry/
Vincent Ladeuil
v.ladeuil+lp at free.fr
Wed Aug 17 16:11:26 UTC 2011
At file:///home/vila/src/bzr/experimental/stack-registry/
------------------------------------------------------------
revno: 6077
revision-id: v.ladeuil+lp at free.fr-20110817161126-idg5pt6n7zm9e0ok
parent: pqm at pqm.ubuntu.com-20110817084016-600z65qzqmmt44w7
committer: Vincent Ladeuil <v.ladeuil+lp at free.fr>
branch nick: stack-registry
timestamp: Wed 2011-08-17 18:11:26 +0200
message:
Add the missing config stacks and store
-------------- next part --------------
=== modified file 'bzrlib/config.py'
--- a/bzrlib/config.py 2011-08-16 15:12:39 +0000
+++ b/bzrlib/config.py 2011-08-17 16:11:26 +0000
@@ -2759,6 +2759,14 @@
super(BranchStore, self).save()
+class ControlStore(LockableIniFileStore):
+
+ def __init__(self, bzrdir):
+ super(ControlStore, self).__init__(bzrdir.transport,
+ 'control.conf',
+ lock_dir_name='branch_lock')
+
+
class SectionMatcher(object):
"""Select sections into a given Store.
@@ -3010,6 +3018,7 @@
super(LocationStack, self).__init__(
[matcher.get_sections, gstore.get_sections], lstore)
+
class BranchStack(_CompatibleStack):
def __init__(self, branch):
@@ -3023,6 +3032,26 @@
self.branch = branch
+class RemoteControlStack(_CompatibleStack):
+
+ def __init__(self, bzrdir):
+ cstore = ControlStore(bzrdir)
+ super(RemoteControlStack, self).__init__(
+ [cstore.get_sections],
+ cstore)
+ self.bzrdir = bzrdir
+
+
+class RemoteBranchStack(_CompatibleStack):
+
+ def __init__(self, branch):
+ bstore = BranchStore(branch)
+ super(RemoteBranchStack, self).__init__(
+ [bstore.get_sections],
+ bstore)
+ self.branch = branch
+
+
class cmd_config(commands.Command):
__doc__ = """Display, set or remove a configuration option.
=== modified file 'bzrlib/lock.py'
--- a/bzrlib/lock.py 2011-06-28 21:47:24 +0000
+++ b/bzrlib/lock.py 2011-08-17 16:11:26 +0000
@@ -535,7 +535,7 @@
locked the same way), and -Drelock is set, then this will trace.note a
message about it.
"""
-
+
_prev_lock = None
def _note_lock(self, lock_type):
=== modified file 'bzrlib/tests/test_config.py'
--- a/bzrlib/tests/test_config.py 2011-08-12 14:07:21 +0000
+++ b/bzrlib/tests/test_config.py 2011-08-17 16:11:26 +0000
@@ -116,6 +116,13 @@
config.test_store_builder_registry.register('branch', build_branch_store)
+def build_control_store(test):
+ build_backing_branch(test, 'branch')
+ b = bzrdir.BzrDir.open('branch')
+ return config.ControlStore(b)
+config.test_store_builder_registry.register('control', build_control_store)
+
+
def build_remote_branch_store(test):
# There is only one permutation (but we won't be able to handle more with
# this design anyway)
@@ -148,10 +155,23 @@
server_class) = transport_remote.get_test_permutations()[0]
build_backing_branch(test, 'branch', transport_class, server_class)
b = branch.Branch.open(test.get_url('branch'))
- return config.BranchStack(b)
+ return config.RemoteBranchStack(b)
config.test_stack_builder_registry.register('remote_branch',
build_remote_branch_stack)
+def build_remote_control_stack(test):
+ # There is only one permutation (but we won't be able to handle more with
+ # this design anyway)
+ (transport_class,
+ server_class) = transport_remote.get_test_permutations()[0]
+ # We need only a bzrdir for this, not a full branch, but it's not worth
+ # creating a dedicated helper to create only the bzrdir
+ build_backing_branch(test, 'branch', transport_class, server_class)
+ b = branch.Branch.open(test.get_url('branch'))
+ return config.RemoteControlStack(b.bzrdir)
+config.test_stack_builder_registry.register('remote_control',
+ build_remote_control_stack)
+
sample_long_alias="log -r-15..-1 --line"
sample_config_text = u"""
More information about the bazaar-commits
mailing list