mirror of
https://github.com/borgbackup/borg.git
synced 2024-12-25 01:06:50 +00:00
borg rename NAME NEWNAME
This commit is contained in:
parent
206245f3cd
commit
c085c2744b
2 changed files with 6 additions and 6 deletions
|
@ -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')
|
||||
|
||||
|
|
|
@ -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'))
|
||||
|
|
Loading…
Reference in a new issue