/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: Neil Martinsen-Burrell
  • Date: 2011-05-19 01:42:12 UTC
  • mfrom: (5876 +trunk)
  • mto: This revision was merged to the branch mainline in revision 5899.
  • Revision ID: nmb@wartburg.edu-20110519014212-d48xtqqeauq164al
merge bzr.dev, fix release notes conflict

Show diffs side-by-side

added added

removed removed

Lines of Context:
1205
1205
 
1206
1206
    To retrieve the branch as of a particular revision, supply the --revision
1207
1207
    parameter, as in "branch foo/bar -r 5".
 
1208
 
 
1209
    The synonyms 'clone' and 'get' for this command are deprecated.
1208
1210
    """
1209
1211
 
1210
1212
    _see_also = ['checkout']
1240
1242
            files_from=None):
1241
1243
        from bzrlib import switch as _mod_switch
1242
1244
        from bzrlib.tag import _merge_tags_if_possible
 
1245
        if self.invoked_as in ['get', 'clone']:
 
1246
            ui.ui_factory.show_user_warning(
 
1247
                'deprecated_command',
 
1248
                deprecated_name=self.invoked_as,
 
1249
                recommended_name='branch',
 
1250
                deprecated_in_version='2.4')
1243
1251
        accelerator_tree, br_from = bzrdir.BzrDir.open_tree_or_branch(
1244
1252
            from_location)
1245
1253
        if not (hardlink or files_from):
2788
2796
            bzr ignore "RE:(?!debian/).*"
2789
2797
        
2790
2798
        Ignore everything except the "local" toplevel directory,
2791
 
        but always ignore "*~" autosave files, even under local/::
 
2799
        but always ignore autosave files ending in ~, even under local/::
2792
2800
        
2793
2801
            bzr ignore "*"
2794
2802
            bzr ignore "!./local"
3106
3114
      to trigger updates to external systems like bug trackers. The --fixes
3107
3115
      option can be used to record the association between a revision and
3108
3116
      one or more bugs. See ``bzr help bugs`` for details.
3109
 
 
3110
 
      A selective commit may fail in some cases where the committed
3111
 
      tree would be invalid. Consider::
3112
 
  
3113
 
        bzr init foo
3114
 
        mkdir foo/bar
3115
 
        bzr add foo/bar
3116
 
        bzr commit foo -m "committing foo"
3117
 
        bzr mv foo/bar foo/baz
3118
 
        mkdir foo/bar
3119
 
        bzr add foo/bar
3120
 
        bzr commit foo/bar -m "committing bar but not baz"
3121
 
  
3122
 
      In the example above, the last commit will fail by design. This gives
3123
 
      the user the opportunity to decide whether they want to commit the
3124
 
      rename at the same time, separately first, or not at all. (As a general
3125
 
      rule, when in doubt, Bazaar has a policy of Doing the Safe Thing.)
3126
3117
    """
3127
 
    # TODO: Run hooks on tree to-be-committed, and after commit.
3128
 
 
3129
 
    # TODO: Strict commit that fails if there are deleted files.
3130
 
    #       (what does "deleted files" mean ??)
3131
 
 
3132
 
    # TODO: Give better message for -s, --summary, used by tla people
3133
 
 
3134
 
    # XXX: verbose currently does nothing
3135
3118
 
3136
3119
    _see_also = ['add', 'bugs', 'hooks', 'uncommit']
3137
3120
    takes_args = ['selected*']
3169
3152
             Option('show-diff', short_name='p',
3170
3153
                    help='When no message is supplied, show the diff along'
3171
3154
                    ' with the status summary in the message editor.'),
 
3155
             Option('lossy', 
 
3156
                    help='When committing to a foreign version control '
 
3157
                    'system do not push data that can not be natively '
 
3158
                    'represented.'),
3172
3159
             ]
3173
3160
    aliases = ['ci', 'checkin']
3174
3161
 
3193
3180
 
3194
3181
    def run(self, message=None, file=None, verbose=False, selected_list=None,
3195
3182
            unchanged=False, strict=False, local=False, fixes=None,
3196
 
            author=None, show_diff=False, exclude=None, commit_time=None):
 
3183
            author=None, show_diff=False, exclude=None, commit_time=None,
 
3184
            lossy=False):
3197
3185
        from bzrlib.errors import (
3198
3186
            PointlessCommit,
3199
3187
            ConflictsInTree,
3213
3201
                raise errors.BzrCommandError(
3214
3202
                    "Could not parse --commit-time: " + str(e))
3215
3203
 
3216
 
        # TODO: Need a blackbox test for invoking the external editor; may be
3217
 
        # slightly problematic to run this cross-platform.
3218
 
 
3219
 
        # TODO: do more checks that the commit will succeed before
3220
 
        # spending the user's valuable time typing a commit message.
3221
 
 
3222
3204
        properties = {}
3223
3205
 
3224
3206
        tree, selected_list = WorkingTree.open_containing_paths(selected_list)
3301
3283
                        reporter=None, verbose=verbose, revprops=properties,
3302
3284
                        authors=author, timestamp=commit_stamp,
3303
3285
                        timezone=offset,
3304
 
                        exclude=tree.safe_relpath_files(exclude))
 
3286
                        exclude=tree.safe_relpath_files(exclude),
 
3287
                        lossy=lossy)
3305
3288
        except PointlessCommit:
3306
3289
            raise errors.BzrCommandError("No changes to commit."
3307
 
                              " Use --unchanged to commit anyhow.")
 
3290
                " Please 'bzr add' the files you want to commit, or use"
 
3291
                " --unchanged to force an empty commit.")
3308
3292
        except ConflictsInTree:
3309
3293
            raise errors.BzrCommandError('Conflicts detected in working '
3310
3294
                'tree.  Use "bzr conflicts" to list, "bzr resolve FILE" to'
3873
3857
 
3874
3858
    Use bzr resolve when you have fixed a problem.  See also bzr conflicts.
3875
3859
 
3876
 
    If there is no default branch set, the first merge will set it. After
3877
 
    that, you can omit the branch to use the default.  To change the
3878
 
    default, use --remember. The value will only be saved if the remote
3879
 
    location can be accessed.
 
3860
    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.
3880
3864
 
3881
3865
    The results of the merge are placed into the destination working
3882
3866
    directory, where they can be reviewed (with bzr diff), tested, and then
3947
3931
    ]
3948
3932
 
3949
3933
    def run(self, location=None, revision=None, force=False,
3950
 
            merge_type=None, show_base=False, reprocess=None, remember=False,
 
3934
            merge_type=None, show_base=False, reprocess=None, remember=None,
3951
3935
            uncommitted=False, pull=False,
3952
3936
            directory=None,
3953
3937
            preview=False,
4015
3999
            merger.other_rev_id is not None):
4016
4000
            note('Nothing to do.')
4017
4001
            return 0
4018
 
        if pull:
 
4002
        if pull and not preview:
4019
4003
            if merger.interesting_files is not None:
4020
4004
                raise errors.BzrCommandError('Cannot pull individual files')
4021
4005
            if (merger.base_rev_id == tree.last_revision()):
4130
4114
        if other_revision_id is None:
4131
4115
            other_revision_id = _mod_revision.ensure_null(
4132
4116
                other_branch.last_revision())
4133
 
        # Remember where we merge from
4134
 
        if ((remember or tree.branch.get_submit_branch() is None) and
4135
 
             user_location is not None):
 
4117
        # Remember where we merge from. We need to remember if:
 
4118
        # - user specify a location (and we don't merge from the parent
 
4119
        #   branch)
 
4120
        # - user ask to remember or there is no previous location set to merge
 
4121
        #   from and user didn't ask to *not* remember
 
4122
        if (user_location is not None
 
4123
            and ((remember
 
4124
                  or (remember is None
 
4125
                      and tree.branch.get_submit_branch() is None)))):
4136
4126
            tree.branch.set_submit_branch(other_branch.base)
4137
4127
        # Merge tags (but don't set them in the master branch yet, the user
4138
4128
        # might revert this merge).  Commit will propagate them.
4649
4639
    @display_command
4650
4640
    def run(self, verbose=False):
4651
4641
        from bzrlib import plugin
 
4642
        # Don't give writelines a generator as some codecs don't like that
4652
4643
        self.outf.writelines(
4653
 
            plugin.describe_plugins(show_paths=verbose))
 
4644
            list(plugin.describe_plugins(show_paths=verbose)))
4654
4645
 
4655
4646
 
4656
4647
class cmd_testament(Command):
4709
4700
    @display_command
4710
4701
    def run(self, filename, all=False, long=False, revision=None,
4711
4702
            show_ids=False, directory=None):
4712
 
        from bzrlib.annotate import annotate_file, annotate_file_tree
 
4703
        from bzrlib.annotate import (
 
4704
            annotate_file_tree,
 
4705
            )
4713
4706
        wt, branch, relpath = \
4714
4707
            _open_directory_or_containing_tree_or_branch(filename, directory)
4715
4708
        if wt is not None:
4730
4723
            annotate_file_tree(wt, file_id, self.outf, long, all,
4731
4724
                show_ids=show_ids)
4732
4725
        else:
4733
 
            file_version = tree.inventory[file_id].revision
4734
 
            annotate_file(branch, file_version, file_id, long, all, self.outf,
4735
 
                          show_ids=show_ids)
 
4726
            annotate_file_tree(tree, file_id, self.outf, long, all,
 
4727
                show_ids=show_ids, branch=branch)
4736
4728
 
4737
4729
 
4738
4730
class cmd_re_sign(Command):
6169
6161
            self.outf.write('%s %s\n' % (path, location))
6170
6162
 
6171
6163
 
 
6164
class cmd_export_pot(Command):
 
6165
    __doc__ = """Export command helps and error messages in po format."""
 
6166
 
 
6167
    hidden = True
 
6168
 
 
6169
    def run(self):
 
6170
        from bzrlib.export_pot import export_pot
 
6171
        export_pot(self.outf)
 
6172
 
 
6173
 
6172
6174
def _register_lazy_builtins():
6173
6175
    # register lazy builtins from other modules; called at startup and should
6174
6176
    # be only called once.