浏览代码

enable placeholder usage in all extra archive arguments

Elmar Hoffmann 6 年之前
父节点
当前提交
a26065064d
共有 2 个文件被更改,包括 3 次插入4 次删除
  1. 2 4
      src/borg/archiver.py
  2. 1 0
      src/borg/helpers/parseformat.py

+ 2 - 4
src/borg/archiver.py

@@ -1071,8 +1071,7 @@ class Archiver:
     @with_archive
     @with_archive
     def do_rename(self, args, repository, manifest, key, cache, archive):
     def do_rename(self, args, repository, manifest, key, cache, archive):
         """Rename an existing archive"""
         """Rename an existing archive"""
-        name = replace_placeholders(args.name)
-        archive.rename(name)
+        archive.rename(args.name)
         manifest.write()
         manifest.write()
         repository.commit(compact=False)
         repository.commit(compact=False)
         cache.commit()
         cache.commit()
@@ -1545,11 +1544,10 @@ class Archiver:
 
 
         if args.location.archive:
         if args.location.archive:
             name = args.location.archive
             name = args.location.archive
-            target = replace_placeholders(args.target) if args.target else None
             if recreater.is_temporary_archive(name):
             if recreater.is_temporary_archive(name):
                 self.print_error('Refusing to work on temporary archive of prior recreate: %s', name)
                 self.print_error('Refusing to work on temporary archive of prior recreate: %s', name)
                 return self.exit_code
                 return self.exit_code
-            if not recreater.recreate(name, args.comment, target):
+            if not recreater.recreate(name, args.comment, args.target):
                 self.print_error('Nothing to do. Archive was not processed.\n'
                 self.print_error('Nothing to do. Archive was not processed.\n'
                                  'Specify at least one pattern, PATH, --comment, re-compression or re-chunking option.')
                                  'Specify at least one pattern, PATH, --comment, re-compression or re-chunking option.')
         else:
         else:

+ 1 - 0
src/borg/helpers/parseformat.py

@@ -498,6 +498,7 @@ def location_validator(archive=None, proto=None):
 
 
 def archivename_validator():
 def archivename_validator():
     def validator(text):
     def validator(text):
+        text = replace_placeholders(text)
         if '/' in text or '::' in text or not text:
         if '/' in text or '::' in text or not text:
             raise argparse.ArgumentTypeError('Invalid repository name: "%s"' % text)
             raise argparse.ArgumentTypeError('Invalid repository name: "%s"' % text)
         return text
         return text