~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/builtins.py

  • Committer: Aaron Bentley
  • Date: 2009-04-01 20:30:51 UTC
  • mto: This revision was merged to the branch mainline in revision 4241.
  • Revision ID: aaron@aaronbentley.com-20090401203051-d69lplsnxovk6nxi
Finish up conversion to mv --auto.

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.')
 
725
        Option('auto', help='Automatically guess renames.'),
 
726
        Option('dry-run', help='Avoid making changes when guessing renames.'),
726
727
        ]
727
728
    aliases = ['move', 'rename']
728
729
    encoding_type = 'replace'
729
730
 
730
 
    def run(self, names_list, after=False, auto=False):
 
731
    def run(self, names_list, after=False, auto=False, dry_run=False):
731
732
        if auto:
732
 
            return self.run_auto(names_list)
 
733
            return self.run_auto(names_list, after, dry_run)
 
734
        elif dry_run:
 
735
            raise errors.BzrCommandError('--dry-run requires --auto.')
733
736
        if names_list is None:
734
737
            names_list = []
735
738
        if len(names_list) < 2:
741
744
        finally:
742
745
            tree.unlock()
743
746
 
744
 
    def run_auto(self, names_list):
 
747
    def run_auto(self, names_list, after, dry_run):
745
748
        if names_list is not None and len(names_list) > 1:
746
749
            raise errors.BzrCommandError('Only one path may be specified to'
747
750
                                         ' --auto.')
 
751
        if after:
 
752
            raise errors.BzrCommandError('--after cannot be specified with'
 
753
                                         ' --auto.')
748
754
        work_tree, file_list = tree_files(names_list, default_branch='.')
749
755
        work_tree.lock_write()
750
756
        try:
751
 
            rename_map.RenameMap.guess_renames(work_tree)
 
757
            rename_map.RenameMap.guess_renames(work_tree, dry_run)
752
758
        finally:
753
759
            work_tree.unlock()
754
760