/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/builtins.py

  • Committer: Andrew Bennetts
  • Date: 2011-06-02 07:25:33 UTC
  • mfrom: (5952 +trunk)
  • mto: This revision was merged to the branch mainline in revision 5955.
  • Revision ID: andrew.bennetts@canonical.com-20110602072533-v0pe1ivh27cp0pd8
MergeĀ lp:bzr.

Show diffs side-by-side

added added

removed removed

Lines of Context:
44
44
    rename_map,
45
45
    revision as _mod_revision,
46
46
    static_tuple,
47
 
    symbol_versioning,
48
47
    timestamp,
49
48
    transport,
50
49
    ui,
72
71
    _parse_revision_str,
73
72
    )
74
73
from bzrlib.trace import mutter, note, warning, is_quiet, get_verbosity_level
 
74
from bzrlib import (
 
75
    symbol_versioning,
 
76
    )
75
77
 
76
78
 
77
79
@symbol_versioning.deprecated_function(symbol_versioning.deprecated_in((2, 3, 0)))
962
964
    match the remote one, use pull --overwrite. This will work even if the two
963
965
    branches have diverged.
964
966
 
965
 
    If there is no default location set, the first pull will set it.  After
966
 
    that, you can omit the location to use the default.  To change the
967
 
    default, use --remember. The value will only be saved if the remote
968
 
    location can be accessed.
 
967
    If there is no default location set, the first pull will set it (use
 
968
    --no-remember to avoid settting it). After that, you can omit the
 
969
    location to use the default.  To change the default, use --remember. The
 
970
    value will only be saved if the remote location can be accessed.
969
971
 
970
972
    Note: The location can be specified either in the form of a branch,
971
973
    or in the form of a path to a file containing a merge directive generated
990
992
    takes_args = ['location?']
991
993
    encoding_type = 'replace'
992
994
 
993
 
    def run(self, location=None, remember=False, overwrite=False,
 
995
    def run(self, location=None, remember=None, overwrite=False,
994
996
            revision=None, verbose=False,
995
997
            directory=None, local=False,
996
998
            show_base=False):
1047
1049
            branch_from = Branch.open(location,
1048
1050
                possible_transports=possible_transports)
1049
1051
            self.add_cleanup(branch_from.lock_read().unlock)
1050
 
 
1051
 
            if branch_to.get_parent() is None or remember:
 
1052
            # Remembers if asked explicitly or no previous location is set
 
1053
            if (remember
 
1054
                or (remember is None and branch_to.get_parent() is None)):
1052
1055
                branch_to.set_parent(branch_from.base)
1053
1056
 
1054
1057
        if revision is not None:
1098
1101
    do a merge (see bzr help merge) from the other branch, and commit that.
1099
1102
    After that you will be able to do a push without '--overwrite'.
1100
1103
 
1101
 
    If there is no default push location set, the first push will set it.
1102
 
    After that, you can omit the location to use the default.  To change the
1103
 
    default, use --remember. The value will only be saved if the remote
1104
 
    location can be accessed.
 
1104
    If there is no default push location set, the first push will set it (use
 
1105
    --no-remember to avoid settting it).  After that, you can omit the
 
1106
    location to use the default.  To change the default, use --remember. The
 
1107
    value will only be saved if the remote location can be accessed.
1105
1108
    """
1106
1109
 
1107
1110
    _see_also = ['pull', 'update', 'working-trees']
1135
1138
    takes_args = ['location?']
1136
1139
    encoding_type = 'replace'
1137
1140
 
1138
 
    def run(self, location=None, remember=False, overwrite=False,
 
1141
    def run(self, location=None, remember=None, overwrite=False,
1139
1142
        create_prefix=False, verbose=False, revision=None,
1140
1143
        use_existing_dir=False, directory=None, stacked_on=None,
1141
1144
        stacked=False, strict=None, no_tree=False):
3645
3648
        if typestring == "sftp":
3646
3649
            from bzrlib.tests import stub_sftp
3647
3650
            return stub_sftp.SFTPAbsoluteServer
3648
 
        if typestring == "memory":
 
3651
        elif typestring == "memory":
3649
3652
            from bzrlib.tests import test_server
3650
3653
            return memory.MemoryServer
3651
 
        if typestring == "fakenfs":
 
3654
        elif typestring == "fakenfs":
3652
3655
            from bzrlib.tests import test_server
3653
3656
            return test_server.FakeNFSServer
3654
3657
        msg = "No known transport type %s. Supported types are: sftp\n" %\
3688
3691
                     Option('randomize', type=str, argname="SEED",
3689
3692
                            help='Randomize the order of tests using the given'
3690
3693
                                 ' seed or "now" for the current time.'),
3691
 
                     Option('exclude', type=str, argname="PATTERN",
3692
 
                            short_name='x',
3693
 
                            help='Exclude tests that match this regular'
3694
 
                                 ' expression.'),
 
3694
                     ListOption('exclude', type=str, argname="PATTERN",
 
3695
                                short_name='x',
 
3696
                                help='Exclude tests that match this regular'
 
3697
                                ' expression.'),
3695
3698
                     Option('subunit',
3696
3699
                        help='Output test progress via subunit.'),
3697
3700
                     Option('strict', help='Fail on missing dependencies or '
3748
3751
                "--benchmark is no longer supported from bzr 2.2; "
3749
3752
                "use bzr-usertest instead")
3750
3753
        test_suite_factory = None
 
3754
        if not exclude:
 
3755
            exclude_pattern = None
 
3756
        else:
 
3757
            exclude_pattern = '(' + '|'.join(exclude) + ')'
3751
3758
        selftest_kwargs = {"verbose": verbose,
3752
3759
                          "pattern": pattern,
3753
3760
                          "stop_on_failure": one,
3758
3765
                          "matching_tests_first": first,
3759
3766
                          "list_only": list_only,
3760
3767
                          "random_seed": randomize,
3761
 
                          "exclude_pattern": exclude,
 
3768
                          "exclude_pattern": exclude_pattern,
3762
3769
                          "strict": strict,
3763
3770
                          "load_list": load_list,
3764
3771
                          "debug_flags": debugflag,
3833
3840
    The source of the merge can be specified either in the form of a branch,
3834
3841
    or in the form of a path to a file containing a merge directive generated
3835
3842
    with bzr send. If neither is specified, the default is the upstream branch
3836
 
    or the branch most recently merged using --remember.
 
3843
    or the branch most recently merged using --remember.  The source of the
 
3844
    merge may also be specified in the form of a path to a file in another
 
3845
    branch:  in this case, only the modifications to that file are merged into
 
3846
    the current working tree.
3837
3847
 
3838
3848
    When merging from a branch, by default bzr will try to merge in all new
3839
3849
    work from the other branch, automatically determining an appropriate base
3846
3856
    through OTHER, excluding BASE but including OTHER, will be merged.  If this
3847
3857
    causes some revisions to be skipped, i.e. if the destination branch does
3848
3858
    not already contain revision BASE, such a merge is commonly referred to as
3849
 
    a "cherrypick".
 
3859
    a "cherrypick". Unlike a normal merge, Bazaar does not currently track
 
3860
    cherrypicks. The changes look like a normal commit, and the history of the
 
3861
    changes from the other branch is not stored in the commit.
3850
3862
 
3851
3863
    Revision numbers are always relative to the source branch.
3852
3864
 
3858
3870
    Use bzr resolve when you have fixed a problem.  See also bzr conflicts.
3859
3871
 
3860
3872
    If there is no default branch set, the first merge will set it (use
3861
 
    --no-remember to *not* set it). After that, you can omit the branch to use
3862
 
    the default.  To change the default, use --remember. The value will only be
3863
 
    saved if the remote location can be accessed.
 
3873
    --no-remember to avoid settting it). After that, you can omit the branch
 
3874
    to use the default.  To change the default, use --remember. The value will
 
3875
    only be saved if the remote location can be accessed.
3864
3876
 
3865
3877
    The results of the merge are placed into the destination working
3866
3878
    directory, where they can be reviewed (with bzr diff), tested, and then
3867
3879
    committed to record the result of the merge.
3868
3880
 
3869
3881
    merge refuses to run if there are any uncommitted changes, unless
3870
 
    --force is given. The --force option can also be used to create a
 
3882
    --force is given.  If --force is given, then the changes from the source 
 
3883
    will be merged with the current working tree, including any uncommitted
 
3884
    changes in the tree.  The --force option can also be used to create a
3871
3885
    merge revision which has more than two parents.
3872
3886
 
3873
3887
    If one would like to merge changes from the working tree of the other
3945
3959
        merger = None
3946
3960
        allow_pending = True
3947
3961
        verified = 'inapplicable'
 
3962
 
3948
3963
        tree = WorkingTree.open_containing(directory)[0]
 
3964
        if tree.branch.revno() == 0:
 
3965
            raise errors.BzrCommandError('Merging into empty branches not currently supported, '
 
3966
                                         'https://bugs.launchpad.net/bzr/+bug/308562')
3949
3967
 
3950
3968
        try:
3951
3969
            basis_tree = tree.revision_tree(tree.last_revision())
3997
4015
        self.sanity_check_merger(merger)
3998
4016
        if (merger.base_rev_id == merger.other_rev_id and
3999
4017
            merger.other_rev_id is not None):
 
4018
            # check if location is a nonexistent file (and not a branch) to
 
4019
            # disambiguate the 'Nothing to do'
 
4020
            if merger.interesting_files:
 
4021
                if not merger.other_tree.has_filename(
 
4022
                    merger.interesting_files[0]):
 
4023
                    note("merger: " + str(merger))
 
4024
                    raise errors.PathsDoNotExist([location])
4000
4025
            note('Nothing to do.')
4001
4026
            return 0
4002
4027
        if pull and not preview:
4945
4970
 
4946
4971
        if not force:
4947
4972
            if not ui.ui_factory.confirm_action(
4948
 
                    'Uncommit these revisions',
 
4973
                    u'Uncommit these revisions',
4949
4974
                    'bzrlib.builtins.uncommit',
4950
4975
                    {}):
4951
4976
                self.outf.write('Canceled\n')
5287
5312
    source branch defaults to that containing the working directory, but can
5288
5313
    be changed using --from.
5289
5314
 
 
5315
    Both the submit branch and the public branch follow the usual behavior with
 
5316
    respect to --remember: If there is no default location set, the first send
 
5317
    will set it (use --no-remember to avoid settting it). After that, you can
 
5318
    omit the location to use the default.  To change the default, use
 
5319
    --remember. The value will only be saved if the location can be accessed.
 
5320
 
5290
5321
    In order to calculate those changes, bzr must analyse the submit branch.
5291
5322
    Therefore it is most efficient for the submit branch to be a local mirror.
5292
5323
    If a public location is known for the submit_branch, that location is used
5361
5392
        ]
5362
5393
 
5363
5394
    def run(self, submit_branch=None, public_branch=None, no_bundle=False,
5364
 
            no_patch=False, revision=None, remember=False, output=None,
 
5395
            no_patch=False, revision=None, remember=None, output=None,
5365
5396
            format=None, mail_to=None, message=None, body=None,
5366
5397
            strict=None, **kwargs):
5367
5398
        from bzrlib.send import send
5623
5654
            unstacked=None):
5624
5655
        directory = bzrdir.BzrDir.open(location)
5625
5656
        if stacked_on and unstacked:
5626
 
            raise BzrCommandError("Can't use both --stacked-on and --unstacked")
 
5657
            raise errors.BzrCommandError("Can't use both --stacked-on and --unstacked")
5627
5658
        elif stacked_on is not None:
5628
5659
            reconfigure.ReconfigureStackedOn().apply(directory, stacked_on)
5629
5660
        elif unstacked: