~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/commands.py

  • Committer: Aaron Bentley
  • Date: 2005-08-11 19:06:02 UTC
  • mto: (1092.1.41) (1185.3.4) (974.1.47)
  • mto: This revision was merged to the branch mainline in revision 1110.
  • Revision ID: abentley@panoramicfeedback.com-20050811190602-12035bb1621de724
Avoided unnecessary temp files

Show diffs side-by-side

added added

removed removed

Lines of Context:
1418
1418
              check_clean=(not force), merge_type=merge_type)
1419
1419
 
1420
1420
 
1421
 
 
1422
1421
class cmd_revert(Command):
1423
 
    """Restore selected files from a previous revision.
1424
 
    """
1425
 
    takes_args = ['file+']
1426
 
    def run(self, file_list):
1427
 
        from bzrlib.branch import find_branch
1428
 
        
1429
 
        if not file_list:
1430
 
            file_list = ['.']
1431
 
            
1432
 
        b = find_branch(file_list[0])
1433
 
 
1434
 
        b.revert([b.relpath(f) for f in file_list])
1435
 
 
1436
 
 
1437
 
class cmd_merge_revert(Command):
1438
1422
    """Reverse all changes since the last commit.
1439
1423
 
1440
 
    Only versioned files are affected.  By default, any files that are changed
1441
 
    will be backed up first.  Backup files have a '~' appended to their name.
 
1424
    Only versioned files are affected.  Specify filenames to revert only 
 
1425
    those files.  By default, any files that are changed will be backed up
 
1426
    first.  Backup files have a '~' appended to their name.
1442
1427
    """
1443
1428
    takes_options = ['revision', 'no-backup']
 
1429
    takes_args = ['file*']
 
1430
    aliases = ['merge-revert']
1444
1431
 
1445
 
    def run(self, revision=None, no_backup=False):
 
1432
    def run(self, revision=None, no_backup=False, file_list=None):
1446
1433
        from bzrlib.merge import merge
 
1434
        if file_list is not None:
 
1435
            if len(file_list) == 0:
 
1436
                raise BzrCommandError("No files specified")
1447
1437
        if revision is None:
1448
1438
            revision = [-1]
1449
1439
        elif len(revision) != 1:
1450
 
            raise BzrCommandError('bzr merge-revert --revision takes exactly 1 argument')
 
1440
            raise BzrCommandError('bzr revert --revision takes exactly 1 argument')
1451
1441
        merge(('.', revision[0]), parse_spec('.'),
1452
1442
              check_clean=False,
1453
1443
              ignore_zero=True,
1454
 
              backup_files=not no_backup)
 
1444
              backup_files=not no_backup,
 
1445
              file_list=file_list)
1455
1446
 
1456
1447
 
1457
1448
class cmd_assert_fail(Command):