~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/builtins.py

  • Committer: Jelmer Vernooij
  • Date: 2009-04-06 02:54:14 UTC
  • mfrom: (4253 +trunk)
  • mto: This revision was merged to the branch mainline in revision 4255.
  • Revision ID: jelmer@samba.org-20090406025414-65tpjwcmjp5wa5oj
Merge bzr.dev.

Show diffs side-by-side

added added

removed removed

Lines of Context:
722
722
    takes_args = ['names*']
723
723
    takes_options = [Option("after", help="Move only the bzr identifier"
724
724
        " of the file, because the file has already been moved."),
 
725
        Option('auto', help='Automatically guess renames.'),
 
726
        Option('dry-run', help='Avoid making changes when guessing renames.'),
725
727
        ]
726
728
    aliases = ['move', 'rename']
727
729
    encoding_type = 'replace'
728
730
 
729
 
    def run(self, names_list, after=False):
 
731
    def run(self, names_list, after=False, auto=False, dry_run=False):
 
732
        if auto:
 
733
            return self.run_auto(names_list, after, dry_run)
 
734
        elif dry_run:
 
735
            raise errors.BzrCommandError('--dry-run requires --auto.')
730
736
        if names_list is None:
731
737
            names_list = []
732
 
 
733
738
        if len(names_list) < 2:
734
739
            raise errors.BzrCommandError("missing file argument")
735
740
        tree, rel_names = tree_files(names_list, canonicalize=False)
739
744
        finally:
740
745
            tree.unlock()
741
746
 
 
747
    def run_auto(self, names_list, after, dry_run):
 
748
        if names_list is not None and len(names_list) > 1:
 
749
            raise errors.BzrCommandError('Only one path may be specified to'
 
750
                                         ' --auto.')
 
751
        if after:
 
752
            raise errors.BzrCommandError('--after cannot be specified with'
 
753
                                         ' --auto.')
 
754
        work_tree, file_list = tree_files(names_list, default_branch='.')
 
755
        work_tree.lock_write()
 
756
        try:
 
757
            rename_map.RenameMap.guess_renames(work_tree, dry_run)
 
758
        finally:
 
759
            work_tree.unlock()
 
760
 
742
761
    def _run(self, tree, names_list, rel_names, after):
743
762
        into_existing = osutils.isdir(names_list[-1])
744
763
        if into_existing and len(names_list) == 2:
1301
1320
      basic statistics (like the number of files in the working tree and
1302
1321
      number of revisions in the branch and repository):
1303
1322
 
1304
 
        bzr -v info
 
1323
        bzr info -v
1305
1324
 
1306
1325
      Display the above together with number of committers to the branch:
1307
1326
 
1308
 
        bzr -vv info
 
1327
        bzr info -vv
1309
1328
    """
1310
1329
    _see_also = ['revno', 'working-trees', 'repositories']
1311
1330
    takes_args = ['location?']
2183
2202
            # evil when adding features", we continue to use the
2184
2203
            # original algorithm - per-file-graph - for the "single
2185
2204
            # file that isn't a directory without showing a delta" case.
 
2205
            partial_history = revision and b.repository._format.supports_chks
2186
2206
            match_using_deltas = (len(file_ids) != 1 or filter_by_dir
2187
 
                or delta_type)
 
2207
                or delta_type or partial_history)
2188
2208
 
2189
2209
            # Build the LogRequest and execute it
2190
2210
            if len(file_ids) == 0:
3916
3936
            type=_parse_revision_str,
3917
3937
            help='Filter on local branch revisions (inclusive). '
3918
3938
                'See "help revisionspec" for details.'),
3919
 
        Option('include-merges', 'Show merged revisions.'),
 
3939
        Option('include-merges',
 
3940
               'Show all revisions in addition to the mainline ones.'),
3920
3941
        ]
3921
3942
    encoding_type = 'replace'
3922
3943
 
5267
5288
            urlutils.unescape_for_display(to_branch.base, 'utf-8'))
5268
5289
 
5269
5290
 
5270
 
class cmd_guess_renames(Command):
5271
 
    """Guess which files have been have been renamed, based on their content.
5272
 
 
5273
 
    Only versioned files which have been deleted are candidates for rename
5274
 
    detection, and renames to ignored files will not be detected.
5275
 
    """
5276
 
 
5277
 
    def run(self):
5278
 
        work_tree, file_list = tree_files(None, default_branch='.')
5279
 
        work_tree.lock_write()
5280
 
        try:
5281
 
            rename_map.RenameMap.guess_renames(work_tree)
5282
 
        finally:
5283
 
            work_tree.unlock()
5284
 
 
5285
 
 
5286
5291
class cmd_view(Command):
5287
5292
    """Manage filtered views.
5288
5293