diff --git a/src/borg/archiver.py b/src/borg/archiver.py index 487b31a16..a12034e3c 100644 --- a/src/borg/archiver.py +++ b/src/borg/archiver.py @@ -1508,7 +1508,7 @@ def print_text_output(diff, path): @with_archive def do_rename(self, args, repository, manifest, key, cache, archive): """Rename an existing archive""" - archive.rename(args.name2) + archive.rename(args.newname) manifest.write() repository.commit(compact=False) cache.commit() @@ -4998,10 +4998,10 @@ def define_borg_mount(parser): formatter_class=argparse.RawDescriptionHelpFormatter, help='rename archive') subparser.set_defaults(func=self.do_rename) - subparser.add_argument('--name', metavar='OLDNAME', + subparser.add_argument('name', metavar='OLDNAME', type=archivename_validator(), help='specify the archive name') - subparser.add_argument('--name2', metavar='NEWNAME', + subparser.add_argument('newname', metavar='NEWNAME', type=archivename_validator(), help='specify the new archive name') diff --git a/src/borg/testsuite/archiver.py b/src/borg/testsuite/archiver.py index a22eebe4a..918e8f089 100644 --- a/src/borg/testsuite/archiver.py +++ b/src/borg/testsuite/archiver.py @@ -1508,9 +1508,9 @@ def test_rename(self): self.cmd(f'--repo={self.repository_location}', 'create', '--name=test.2', 'input') self.cmd(f'--repo={self.repository_location}', 'extract', '--name=test', '--dry-run') self.cmd(f'--repo={self.repository_location}', 'extract', '--name=test.2', '--dry-run') - self.cmd(f'--repo={self.repository_location}', 'rename', '--name=test', '--name2=test.3') + self.cmd(f'--repo={self.repository_location}', 'rename', 'test', 'test.3') self.cmd(f'--repo={self.repository_location}', 'extract', '--name=test.2', '--dry-run') - self.cmd(f'--repo={self.repository_location}', 'rename', '--name=test.2', '--name2=test.4') + self.cmd(f'--repo={self.repository_location}', 'rename', 'test.2', 'test.4') self.cmd(f'--repo={self.repository_location}', 'extract', '--name=test.3', '--dry-run') self.cmd(f'--repo={self.repository_location}', 'extract', '--name=test.4', '--dry-run') # Make sure both archives have been renamed @@ -1854,7 +1854,7 @@ def test_unknown_feature_on_rename(self): print(self.cmd(f'--repo={self.repository_location}', 'init', '--encryption=repokey')) self.cmd(f'--repo={self.repository_location}', 'create', '--name=test', 'input') self.add_unknown_feature(Manifest.Operation.CHECK) - self.cmd_raises_unknown_feature([f'--repo={self.repository_location}', 'rename', '--name=test', '--name2=other']) + self.cmd_raises_unknown_feature([f'--repo={self.repository_location}', 'rename', 'test', 'other']) def test_unknown_feature_on_delete(self): print(self.cmd(f'--repo={self.repository_location}', 'init', '--encryption=repokey'))