/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: Jelmer Vernooij
  • Date: 2009-04-03 17:36:43 UTC
  • mfrom: (4222.2.9 ui-username)
  • mto: This revision was merged to the branch mainline in revision 4284.
  • Revision ID: jelmer@samba.org-20090403173643-xcf89aq1bn3yxipt
Merge new username ui call.

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:
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:
5268
5288
            urlutils.unescape_for_display(to_branch.base, 'utf-8'))
5269
5289
 
5270
5290
 
5271
 
class cmd_guess_renames(Command):
5272
 
    """Guess which files have been have been renamed, based on their content.
5273
 
 
5274
 
    Only versioned files which have been deleted are candidates for rename
5275
 
    detection, and renames to ignored files will not be detected.
5276
 
    """
5277
 
 
5278
 
    def run(self):
5279
 
        work_tree, file_list = tree_files(None, default_branch='.')
5280
 
        work_tree.lock_write()
5281
 
        try:
5282
 
            rename_map.RenameMap.guess_renames(work_tree)
5283
 
        finally:
5284
 
            work_tree.unlock()
5285
 
 
5286
 
 
5287
5291
class cmd_view(Command):
5288
5292
    """Manage filtered views.
5289
5293