~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/builtins.py

  • Committer: Jelmer Vernooij
  • Date: 2011-05-10 07:46:15 UTC
  • mfrom: (5844 +trunk)
  • mto: This revision was merged to the branch mainline in revision 5845.
  • Revision ID: jelmer@samba.org-20110510074615-eptod049ndjxc4i7
Merge bzr.dev.

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"
2922
2930
         zip                          .zip
2923
2931
      =================       =========================
2924
2932
    """
 
2933
    encoding = 'exact'
2925
2934
    takes_args = ['dest', 'branch_or_subdir?']
2926
2935
    takes_options = ['directory',
2927
2936
        Option('format',
3105
3114
      to trigger updates to external systems like bug trackers. The --fixes
3106
3115
      option can be used to record the association between a revision and
3107
3116
      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.)
3125
3117
    """
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
3134
3118
 
3135
3119
    _see_also = ['add', 'bugs', 'hooks', 'uncommit']
3136
3120
    takes_args = ['selected*']
3168
3152
             Option('show-diff', short_name='p',
3169
3153
                    help='When no message is supplied, show the diff along'
3170
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.'),
3171
3159
             ]
3172
3160
    aliases = ['ci', 'checkin']
3173
3161
 
3192
3180
 
3193
3181
    def run(self, message=None, file=None, verbose=False, selected_list=None,
3194
3182
            unchanged=False, strict=False, local=False, fixes=None,
3195
 
            author=None, show_diff=False, exclude=None, commit_time=None):
 
3183
            author=None, show_diff=False, exclude=None, commit_time=None,
 
3184
            lossy=False):
3196
3185
        from bzrlib.errors import (
3197
3186
            PointlessCommit,
3198
3187
            ConflictsInTree,
3212
3201
                raise errors.BzrCommandError(
3213
3202
                    "Could not parse --commit-time: " + str(e))
3214
3203
 
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
 
 
3221
3204
        properties = {}
3222
3205
 
3223
3206
        tree, selected_list = WorkingTree.open_containing_paths(selected_list)
3300
3283
                        reporter=None, verbose=verbose, revprops=properties,
3301
3284
                        authors=author, timestamp=commit_stamp,
3302
3285
                        timezone=offset,
3303
 
                        exclude=tree.safe_relpath_files(exclude))
 
3286
                        exclude=tree.safe_relpath_files(exclude),
 
3287
                        lossy=lossy)
3304
3288
        except PointlessCommit:
3305
3289
            raise errors.BzrCommandError("No changes to commit."
3306
 
                              " Use --unchanged to commit anyhow.")
 
3290
                " Please 'bzr add' the files you want to commit, or use"
 
3291
                " --unchanged to force an empty commit.")
3307
3292
        except ConflictsInTree:
3308
3293
            raise errors.BzrCommandError('Conflicts detected in working '
3309
3294
                'tree.  Use "bzr conflicts" to list, "bzr resolve FILE" to'
4014
3999
            merger.other_rev_id is not None):
4015
4000
            note('Nothing to do.')
4016
4001
            return 0
4017
 
        if pull:
 
4002
        if pull and not preview:
4018
4003
            if merger.interesting_files is not None:
4019
4004
                raise errors.BzrCommandError('Cannot pull individual files')
4020
4005
            if (merger.base_rev_id == tree.last_revision()):
4708
4693
    @display_command
4709
4694
    def run(self, filename, all=False, long=False, revision=None,
4710
4695
            show_ids=False, directory=None):
4711
 
        from bzrlib.annotate import annotate_file, annotate_file_tree
 
4696
        from bzrlib.annotate import (
 
4697
            annotate_file_tree,
 
4698
            )
4712
4699
        wt, branch, relpath = \
4713
4700
            _open_directory_or_containing_tree_or_branch(filename, directory)
4714
4701
        if wt is not None:
4729
4716
            annotate_file_tree(wt, file_id, self.outf, long, all,
4730
4717
                show_ids=show_ids)
4731
4718
        else:
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)
 
4719
            annotate_file_tree(tree, file_id, self.outf, long, all,
 
4720
                show_ids=show_ids, branch=branch)
4735
4721
 
4736
4722
 
4737
4723
class cmd_re_sign(Command):