~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/builtins.py

  • Committer: Jelmer Vernooij
  • Date: 2011-03-10 13:52:27 UTC
  • mto: (5712.4.5 bzrdir-weave)
  • mto: This revision was merged to the branch mainline in revision 5716.
  • Revision ID: jelmer@samba.org-20110310135227-ufcw0utlwsp8r6k6
Revert registry changes.

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.
1210
1208
    """
1211
1209
 
1212
1210
    _see_also = ['checkout']
1242
1240
            files_from=None):
1243
1241
        from bzrlib import switch as _mod_switch
1244
1242
        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')
1251
1243
        accelerator_tree, br_from = bzrdir.BzrDir.open_tree_or_branch(
1252
1244
            from_location)
1253
1245
        if not (hardlink or files_from):
2796
2788
            bzr ignore "RE:(?!debian/).*"
2797
2789
        
2798
2790
        Ignore everything except the "local" toplevel directory,
2799
 
        but always ignore autosave files ending in ~, even under local/::
 
2791
        but always ignore "*~" autosave files, even under local/::
2800
2792
        
2801
2793
            bzr ignore "*"
2802
2794
            bzr ignore "!./local"
2930
2922
         zip                          .zip
2931
2923
      =================       =========================
2932
2924
    """
2933
 
    encoding = 'exact'
2934
2925
    takes_args = ['dest', 'branch_or_subdir?']
2935
2926
    takes_options = ['directory',
2936
2927
        Option('format',
3114
3105
      to trigger updates to external systems like bug trackers. The --fixes
3115
3106
      option can be used to record the association between a revision and
3116
3107
      one or more bugs. See ``bzr help bugs`` for details.
 
3108
 
 
3109
      A selective commit may fail in some cases where the committed
 
3110
      tree would be invalid. Consider::
 
3111
  
 
3112
        bzr init foo
 
3113
        mkdir foo/bar
 
3114
        bzr add foo/bar
 
3115
        bzr commit foo -m "committing foo"
 
3116
        bzr mv foo/bar foo/baz
 
3117
        mkdir foo/bar
 
3118
        bzr add foo/bar
 
3119
        bzr commit foo/bar -m "committing bar but not baz"
 
3120
  
 
3121
      In the example above, the last commit will fail by design. This gives
 
3122
      the user the opportunity to decide whether they want to commit the
 
3123
      rename at the same time, separately first, or not at all. (As a general
 
3124
      rule, when in doubt, Bazaar has a policy of Doing the Safe Thing.)
3117
3125
    """
 
3126
    # TODO: Run hooks on tree to-be-committed, and after commit.
 
3127
 
 
3128
    # TODO: Strict commit that fails if there are deleted files.
 
3129
    #       (what does "deleted files" mean ??)
 
3130
 
 
3131
    # TODO: Give better message for -s, --summary, used by tla people
 
3132
 
 
3133
    # XXX: verbose currently does nothing
3118
3134
 
3119
3135
    _see_also = ['add', 'bugs', 'hooks', 'uncommit']
3120
3136
    takes_args = ['selected*']
3152
3168
             Option('show-diff', short_name='p',
3153
3169
                    help='When no message is supplied, show the diff along'
3154
3170
                    ' 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.'),
3159
3171
             ]
3160
3172
    aliases = ['ci', 'checkin']
3161
3173
 
3180
3192
 
3181
3193
    def run(self, message=None, file=None, verbose=False, selected_list=None,
3182
3194
            unchanged=False, strict=False, local=False, fixes=None,
3183
 
            author=None, show_diff=False, exclude=None, commit_time=None,
3184
 
            lossy=False):
 
3195
            author=None, show_diff=False, exclude=None, commit_time=None):
3185
3196
        from bzrlib.errors import (
3186
3197
            PointlessCommit,
3187
3198
            ConflictsInTree,
3201
3212
                raise errors.BzrCommandError(
3202
3213
                    "Could not parse --commit-time: " + str(e))
3203
3214
 
 
3215
        # TODO: Need a blackbox test for invoking the external editor; may be
 
3216
        # slightly problematic to run this cross-platform.
 
3217
 
 
3218
        # TODO: do more checks that the commit will succeed before
 
3219
        # spending the user's valuable time typing a commit message.
 
3220
 
3204
3221
        properties = {}
3205
3222
 
3206
3223
        tree, selected_list = WorkingTree.open_containing_paths(selected_list)
3283
3300
                        reporter=None, verbose=verbose, revprops=properties,
3284
3301
                        authors=author, timestamp=commit_stamp,
3285
3302
                        timezone=offset,
3286
 
                        exclude=tree.safe_relpath_files(exclude),
3287
 
                        lossy=lossy)
 
3303
                        exclude=tree.safe_relpath_files(exclude))
3288
3304
        except PointlessCommit:
3289
3305
            raise errors.BzrCommandError("No changes to commit."
3290
 
                " Please 'bzr add' the files you want to commit, or use"
3291
 
                " --unchanged to force an empty commit.")
 
3306
                              " Use --unchanged to commit anyhow.")
3292
3307
        except ConflictsInTree:
3293
3308
            raise errors.BzrCommandError('Conflicts detected in working '
3294
3309
                'tree.  Use "bzr conflicts" to list, "bzr resolve FILE" to'
3999
4014
            merger.other_rev_id is not None):
4000
4015
            note('Nothing to do.')
4001
4016
            return 0
4002
 
        if pull and not preview:
 
4017
        if pull:
4003
4018
            if merger.interesting_files is not None:
4004
4019
                raise errors.BzrCommandError('Cannot pull individual files')
4005
4020
            if (merger.base_rev_id == tree.last_revision()):
4693
4708
    @display_command
4694
4709
    def run(self, filename, all=False, long=False, revision=None,
4695
4710
            show_ids=False, directory=None):
4696
 
        from bzrlib.annotate import (
4697
 
            annotate_file_tree,
4698
 
            )
 
4711
        from bzrlib.annotate import annotate_file, annotate_file_tree
4699
4712
        wt, branch, relpath = \
4700
4713
            _open_directory_or_containing_tree_or_branch(filename, directory)
4701
4714
        if wt is not None:
4716
4729
            annotate_file_tree(wt, file_id, self.outf, long, all,
4717
4730
                show_ids=show_ids)
4718
4731
        else:
4719
 
            annotate_file_tree(tree, file_id, self.outf, long, all,
4720
 
                show_ids=show_ids, branch=branch)
 
4732
            file_version = tree.inventory[file_id].revision
 
4733
            annotate_file(branch, file_version, file_id, long, all, self.outf,
 
4734
                          show_ids=show_ids)
4721
4735
 
4722
4736
 
4723
4737
class cmd_re_sign(Command):
6154
6168
            self.outf.write('%s %s\n' % (path, location))
6155
6169
 
6156
6170
 
6157
 
class cmd_export_pot(Command):
6158
 
    __doc__ = """Export command helps and error messages in po format."""
6159
 
 
6160
 
    hidden = True
6161
 
 
6162
 
    def run(self):
6163
 
        from bzrlib.export_pot import export_pot
6164
 
        export_pot(self.outf)
6165
 
 
6166
 
 
6167
6171
def _register_lazy_builtins():
6168
6172
    # register lazy builtins from other modules; called at startup and should
6169
6173
    # be only called once.