~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/config.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2011-08-22 10:38:57 UTC
  • mfrom: (6076.1.2 missing-stacks)
  • Revision ID: pqm@pqm.ubuntu.com-20110822103857-e7kb6tge3sfw4dt7
(vila) Add missing config store and stacks for control.conf and remote
 branches. (Vincent Ladeuil)

Show diffs side-by-side

added added

removed removed

Lines of Context:
2812
2812
        super(BranchStore, self).save()
2813
2813
 
2814
2814
 
 
2815
class ControlStore(LockableIniFileStore):
 
2816
 
 
2817
    def __init__(self, bzrdir):
 
2818
        super(ControlStore, self).__init__(bzrdir.transport,
 
2819
                                          'control.conf',
 
2820
                                           lock_dir_name='branch_lock')
 
2821
 
 
2822
 
2815
2823
class SectionMatcher(object):
2816
2824
    """Select sections into a given Store.
2817
2825
 
3048
3056
 
3049
3057
 
3050
3058
class GlobalStack(_CompatibleStack):
 
3059
    """Global options only stack."""
3051
3060
 
3052
3061
    def __init__(self):
3053
3062
        # Get a GlobalStore
3056
3065
 
3057
3066
 
3058
3067
class LocationStack(_CompatibleStack):
 
3068
    """Per-location options falling back to global options stack."""
3059
3069
 
3060
3070
    def __init__(self, location):
3061
3071
        """Make a new stack for a location and global configuration.
3067
3077
        super(LocationStack, self).__init__(
3068
3078
            [matcher.get_sections, gstore.get_sections], lstore)
3069
3079
 
 
3080
 
3070
3081
class BranchStack(_CompatibleStack):
 
3082
    """Per-location options falling back to branch then global options stack."""
3071
3083
 
3072
3084
    def __init__(self, branch):
3073
3085
        bstore = BranchStore(branch)
3080
3092
        self.branch = branch
3081
3093
 
3082
3094
 
 
3095
class RemoteControlStack(_CompatibleStack):
 
3096
    """Remote control-only options stack."""
 
3097
 
 
3098
    def __init__(self, bzrdir):
 
3099
        cstore = ControlStore(bzrdir)
 
3100
        super(RemoteControlStack, self).__init__(
 
3101
            [cstore.get_sections],
 
3102
            cstore)
 
3103
        self.bzrdir = bzrdir
 
3104
 
 
3105
 
 
3106
class RemoteBranchStack(_CompatibleStack):
 
3107
    """Remote branch-only options stack."""
 
3108
 
 
3109
    def __init__(self, branch):
 
3110
        bstore = BranchStore(branch)
 
3111
        super(RemoteBranchStack, self).__init__(
 
3112
            [bstore.get_sections],
 
3113
            bstore)
 
3114
        self.branch = branch
 
3115
 
 
3116
 
3083
3117
class cmd_config(commands.Command):
3084
3118
    __doc__ = """Display, set or remove a configuration option.
3085
3119