Rev 6092: (vila) Add missing config store and stacks for control.conf and remote in file:///home/pqm/archives/thelove/bzr/%2Btrunk/
Canonical.com Patch Queue Manager
pqm at pqm.ubuntu.com
Mon Aug 22 10:39:09 UTC 2011
At file:///home/pqm/archives/thelove/bzr/%2Btrunk/
------------------------------------------------------------
revno: 6092 [merge]
revision-id: pqm at pqm.ubuntu.com-20110822103857-e7kb6tge3sfw4dt7
parent: pqm at pqm.ubuntu.com-20110821172104-y77ef15d94kom6hl
parent: v.ladeuil+lp at free.fr-20110822075315-h7hnp4l2i06og9ja
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Mon 2011-08-22 10:38:57 +0000
message:
(vila) Add missing config store and stacks for control.conf and remote
branches. (Vincent Ladeuil)
modified:
bzrlib/config.py config.py-20051011043216-070c74f4e9e338e8
bzrlib/lock.py lock.py-20050527050856-ec090bb51bc03349
bzrlib/tests/test_config.py testconfig.py-20051011041908-742d0c15d8d8c8eb
=== modified file 'bzrlib/config.py'
--- a/bzrlib/config.py 2011-08-21 15:14:57 +0000
+++ b/bzrlib/config.py 2011-08-22 10:38:57 +0000
@@ -2812,6 +2812,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.
@@ -3048,6 +3056,7 @@
class GlobalStack(_CompatibleStack):
+ """Global options only stack."""
def __init__(self):
# Get a GlobalStore
@@ -3056,6 +3065,7 @@
class LocationStack(_CompatibleStack):
+ """Per-location options falling back to global options stack."""
def __init__(self, location):
"""Make a new stack for a location and global configuration.
@@ -3067,7 +3077,9 @@
super(LocationStack, self).__init__(
[matcher.get_sections, gstore.get_sections], lstore)
+
class BranchStack(_CompatibleStack):
+ """Per-location options falling back to branch then global options stack."""
def __init__(self, branch):
bstore = BranchStore(branch)
@@ -3080,6 +3092,28 @@
self.branch = branch
+class RemoteControlStack(_CompatibleStack):
+ """Remote control-only options stack."""
+
+ def __init__(self, bzrdir):
+ cstore = ControlStore(bzrdir)
+ super(RemoteControlStack, self).__init__(
+ [cstore.get_sections],
+ cstore)
+ self.bzrdir = bzrdir
+
+
+class RemoteBranchStack(_CompatibleStack):
+ """Remote branch-only options stack."""
+
+ 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-21 15:14:57 +0000
+++ b/bzrlib/tests/test_config.py 2011-08-22 10:38:57 +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