~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/config.py

(vila) Migrate branch location options to config stacks. (Vincent Ladeuil)

Show diffs side-by-side

added added

removed removed

Lines of Context:
2506
2506
    _list_converter_config.reset()
2507
2507
    _list_converter_config._parse([u"list=%s" % (unicode_str,)])
2508
2508
    maybe_list = _list_converter_config['list']
2509
 
    # ConfigObj return '' instead of u''. Use 'str' below to catch all cases.
2510
2509
    if isinstance(maybe_list, basestring):
2511
2510
        if maybe_list:
2512
2511
            # A single value, most probably the user forgot (or didn't care to
2591
2590
A negative value means disable the size check.
2592
2591
"""))
2593
2592
option_registry.register(
 
2593
    Option('bound',
 
2594
           default=None, from_unicode=bool_from_store,
 
2595
           help="""\
 
2596
Is the branch bound to ``bound_location``.
 
2597
 
 
2598
If set to "True", the branch should act as a checkout, and push each commit to
 
2599
the bound_location.  This option is normally set by ``bind``/``unbind``.
 
2600
 
 
2601
See also: bound_location.
 
2602
"""))
 
2603
option_registry.register(
 
2604
    Option('bound_location',
 
2605
           default=None,
 
2606
           help="""\
 
2607
The location that commits should go to when acting as a checkout.
 
2608
 
 
2609
This option is normally set by ``bind``.
 
2610
 
 
2611
See also: bound.
 
2612
"""))
 
2613
option_registry.register(
2594
2614
    Option('bzr.workingtree.worth_saving_limit', default=10,
2595
2615
           from_unicode=int_from_store,  invalid='warning',
2596
2616
           help='''\
2710
2730
           help= 'Unicode encoding for output'
2711
2731
           ' (terminal encoding if not specified).'))
2712
2732
option_registry.register(
 
2733
    Option('parent_location',
 
2734
           default=None,
 
2735
           help="""\
 
2736
The location of the default branch for pull or merge.
 
2737
 
 
2738
This option is normally set when creating a branch, the first ``pull`` or by
 
2739
``pull --remember``.
 
2740
"""))
 
2741
option_registry.register(
2713
2742
    Option('post_commit', default=None,
2714
2743
           help='''\
2715
2744
Post commit functions.
2719
2748
Each function takes branch, rev_id as parameters.
2720
2749
'''))
2721
2750
option_registry.register(
 
2751
    Option('public_branch',
 
2752
           default=None,
 
2753
           help="""\
 
2754
A publically-accessible version of this branch.
 
2755
 
 
2756
This implies that the branch setting this option is not publically-accessible.
 
2757
Used and set by ``bzr send``.
 
2758
"""))
 
2759
option_registry.register(
 
2760
    Option('push_location',
 
2761
           default=None,
 
2762
           help="""\
 
2763
The location of the default branch for push.
 
2764
 
 
2765
This option is normally set by the first ``push`` or ``push --remember``.
 
2766
"""))
 
2767
option_registry.register(
2722
2768
    Option('push_strict', default=None,
2723
2769
           from_unicode=bool_from_store,
2724
2770
           help='''\
2757
2803
The default value for ``send --strict``.
2758
2804
 
2759
2805
If present, defines the ``--strict`` option default value for checking
2760
 
uncommitted changes before pushing.
 
2806
uncommitted changes before sending a bundle.
2761
2807
'''))
2762
2808
 
2763
2809
option_registry.register(
2765
2811
           default=300.0, from_unicode=float_from_store,
2766
2812
           help="If we wait for a new request from a client for more than"
2767
2813
                " X seconds, consider the client idle, and hangup."))
 
2814
option_registry.register(
 
2815
    Option('stacked_on_location',
 
2816
           default=None,
 
2817
           help="""The location where this branch is stacked on."""))
 
2818
option_registry.register(
 
2819
    Option('submit_branch',
 
2820
           default=None,
 
2821
           help="""\
 
2822
The branch you intend to submit your current work to.
 
2823
 
 
2824
This is automatically set by ``bzr send`` and ``bzr merge``, and is also used
 
2825
by the ``submit:`` revision spec.
 
2826
"""))
2768
2827
 
2769
2828
 
2770
2829
class Section(object):
3650
3709
        self.bzrdir = bzrdir
3651
3710
 
3652
3711
 
3653
 
class RemoteBranchStack(_CompatibleStack):
3654
 
    """Remote branch-only options stack."""
 
3712
class BranchOnlyStack(_CompatibleStack):
 
3713
    """Branch-only options stack."""
3655
3714
 
3656
 
    # FIXME 2011-11-22 JRV This should probably be renamed to avoid confusion
3657
 
    # with the stack used for remote branches. RemoteBranchStack only uses
3658
 
    # branch.conf and is used only for the stack options.
 
3715
    # FIXME: _BranchOnlyStack only uses branch.conf and is used only for the
 
3716
    # stacked_on_location options waiting for http://pad.lv/832042 to be fixed.
 
3717
    # -- vila 2011-12-16
3659
3718
 
3660
3719
    def __init__(self, branch):
3661
3720
        bstore = branch._get_config_store()
3662
 
        super(RemoteBranchStack, self).__init__(
 
3721
        super(BranchOnlyStack, self).__init__(
3663
3722
            [NameMatcher(bstore, None).get_sections],
3664
3723
            bstore)
3665
3724
        self.branch = branch
3666
3725
 
 
3726
 
3667
3727
# Use a an empty dict to initialize an empty configobj avoiding all
3668
3728
# parsing and encoding checks
3669
3729
_quoting_config = configobj.ConfigObj(