~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/builtins.py

  • Committer: Vincent Ladeuil
  • Date: 2011-05-26 20:30:53 UTC
  • mfrom: (5920 +trunk)
  • mto: This revision was merged to the branch mainline in revision 5924.
  • Revision ID: v.ladeuil+lp@free.fr-20110526203053-hbjn6yuzwg03wnuv
MergeĀ fromĀ trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
962
962
    match the remote one, use pull --overwrite. This will work even if the two
963
963
    branches have diverged.
964
964
 
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.
 
965
    If there is no default location set, the first pull will set it (use
 
966
    --no-remember to avoid settting it). After that, you can omit the
 
967
    location to use the default.  To change the default, use --remember. The
 
968
    value will only be saved if the remote location can be accessed.
969
969
 
970
970
    Note: The location can be specified either in the form of a branch,
971
971
    or in the form of a path to a file containing a merge directive generated
990
990
    takes_args = ['location?']
991
991
    encoding_type = 'replace'
992
992
 
993
 
    def run(self, location=None, remember=False, overwrite=False,
 
993
    def run(self, location=None, remember=None, overwrite=False,
994
994
            revision=None, verbose=False,
995
995
            directory=None, local=False,
996
996
            show_base=False):
1047
1047
            branch_from = Branch.open(location,
1048
1048
                possible_transports=possible_transports)
1049
1049
            self.add_cleanup(branch_from.lock_read().unlock)
1050
 
 
1051
 
            if branch_to.get_parent() is None or remember:
 
1050
            # Remembers if asked explicitly or no previous location is set
 
1051
            if (remember
 
1052
                or (remember is None and branch_to.get_parent() is None)):
1052
1053
                branch_to.set_parent(branch_from.base)
1053
1054
 
1054
1055
        if revision is not None:
1098
1099
    do a merge (see bzr help merge) from the other branch, and commit that.
1099
1100
    After that you will be able to do a push without '--overwrite'.
1100
1101
 
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.
 
1102
    If there is no default push location set, the first push will set it (use
 
1103
    --no-remember to avoid settting it).  After that, you can omit the
 
1104
    location to use the default.  To change the default, use --remember. The
 
1105
    value will only be saved if the remote location can be accessed.
1105
1106
    """
1106
1107
 
1107
1108
    _see_also = ['pull', 'update', 'working-trees']
1135
1136
    takes_args = ['location?']
1136
1137
    encoding_type = 'replace'
1137
1138
 
1138
 
    def run(self, location=None, remember=False, overwrite=False,
 
1139
    def run(self, location=None, remember=None, overwrite=False,
1139
1140
        create_prefix=False, verbose=False, revision=None,
1140
1141
        use_existing_dir=False, directory=None, stacked_on=None,
1141
1142
        stacked=False, strict=None, no_tree=False):
3846
3847
    through OTHER, excluding BASE but including OTHER, will be merged.  If this
3847
3848
    causes some revisions to be skipped, i.e. if the destination branch does
3848
3849
    not already contain revision BASE, such a merge is commonly referred to as
3849
 
    a "cherrypick".
 
3850
    a "cherrypick". Unlike a normal merge, Bazaar does not currently track
 
3851
    cherrypicks. The changes look like a normal commit, and the history of the
 
3852
    changes from the other branch is not stored in the commit.
3850
3853
 
3851
3854
    Revision numbers are always relative to the source branch.
3852
3855
 
3857
3860
 
3858
3861
    Use bzr resolve when you have fixed a problem.  See also bzr conflicts.
3859
3862
 
3860
 
    If there is no default branch set, the first merge will set it. After
3861
 
    that, you can omit the branch to use the default.  To change the
3862
 
    default, use --remember. The value will only be saved if the remote
3863
 
    location can be accessed.
 
3863
    If there is no default branch set, the first merge will set it (use
 
3864
    --no-remember to avoid settting it). After that, you can omit the branch
 
3865
    to use the default.  To change the default, use --remember. The value will
 
3866
    only be saved if the remote location can be accessed.
3864
3867
 
3865
3868
    The results of the merge are placed into the destination working
3866
3869
    directory, where they can be reviewed (with bzr diff), tested, and then
3931
3934
    ]
3932
3935
 
3933
3936
    def run(self, location=None, revision=None, force=False,
3934
 
            merge_type=None, show_base=False, reprocess=None, remember=False,
 
3937
            merge_type=None, show_base=False, reprocess=None, remember=None,
3935
3938
            uncommitted=False, pull=False,
3936
3939
            directory=None,
3937
3940
            preview=False,
3945
3948
        merger = None
3946
3949
        allow_pending = True
3947
3950
        verified = 'inapplicable'
 
3951
 
3948
3952
        tree = WorkingTree.open_containing(directory)[0]
 
3953
        if tree.branch.revno() == 0:
 
3954
            raise errors.BzrCommandError('Merging into empty branches not currently supported, '
 
3955
                                         'https://bugs.launchpad.net/bzr/+bug/308562')
3949
3956
 
3950
3957
        try:
3951
3958
            basis_tree = tree.revision_tree(tree.last_revision())
4114
4121
        if other_revision_id is None:
4115
4122
            other_revision_id = _mod_revision.ensure_null(
4116
4123
                other_branch.last_revision())
4117
 
        # Remember where we merge from
4118
 
        if ((remember or tree.branch.get_submit_branch() is None) and
4119
 
             user_location is not None):
 
4124
        # Remember where we merge from. We need to remember if:
 
4125
        # - user specify a location (and we don't merge from the parent
 
4126
        #   branch)
 
4127
        # - user ask to remember or there is no previous location set to merge
 
4128
        #   from and user didn't ask to *not* remember
 
4129
        if (user_location is not None
 
4130
            and ((remember
 
4131
                  or (remember is None
 
4132
                      and tree.branch.get_submit_branch() is None)))):
4120
4133
            tree.branch.set_submit_branch(other_branch.base)
4121
4134
        # Merge tags (but don't set them in the master branch yet, the user
4122
4135
        # might revert this merge).  Commit will propagate them.
4633
4646
    @display_command
4634
4647
    def run(self, verbose=False):
4635
4648
        from bzrlib import plugin
 
4649
        # Don't give writelines a generator as some codecs don't like that
4636
4650
        self.outf.writelines(
4637
 
            plugin.describe_plugins(show_paths=verbose))
 
4651
            list(plugin.describe_plugins(show_paths=verbose)))
4638
4652
 
4639
4653
 
4640
4654
class cmd_testament(Command):
5280
5294
    source branch defaults to that containing the working directory, but can
5281
5295
    be changed using --from.
5282
5296
 
 
5297
    Both the submit branch and the public branch follow the usual behavior with
 
5298
    respect to --remember: If there is no default location set, the first send
 
5299
    will set it (use --no-remember to avoid settting it). After that, you can
 
5300
    omit the location to use the default.  To change the default, use
 
5301
    --remember. The value will only be saved if the location can be accessed.
 
5302
 
5283
5303
    In order to calculate those changes, bzr must analyse the submit branch.
5284
5304
    Therefore it is most efficient for the submit branch to be a local mirror.
5285
5305
    If a public location is known for the submit_branch, that location is used
5354
5374
        ]
5355
5375
 
5356
5376
    def run(self, submit_branch=None, public_branch=None, no_bundle=False,
5357
 
            no_patch=False, revision=None, remember=False, output=None,
 
5377
            no_patch=False, revision=None, remember=None, output=None,
5358
5378
            format=None, mail_to=None, message=None, body=None,
5359
5379
            strict=None, **kwargs):
5360
5380
        from bzrlib.send import send
6154
6174
            self.outf.write('%s %s\n' % (path, location))
6155
6175
 
6156
6176
 
 
6177
class cmd_export_pot(Command):
 
6178
    __doc__ = """Export command helps and error messages in po format."""
 
6179
 
 
6180
    hidden = True
 
6181
 
 
6182
    def run(self):
 
6183
        from bzrlib.export_pot import export_pot
 
6184
        export_pot(self.outf)
 
6185
 
 
6186
 
6157
6187
def _register_lazy_builtins():
6158
6188
    # register lazy builtins from other modules; called at startup and should
6159
6189
    # be only called once.