Merge pull request #4637 from elho/second-archive-placeholder-maint

Enable placeholder usage in all extra archive arguments
This commit is contained in:
TW 2019-06-24 09:58:22 +02:00 committed by GitHub
commit 52c6b92598
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 4 deletions

View File

@ -1238,8 +1238,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(args.name)
archive.rename(name)
manifest.write() manifest.write()
repository.commit() repository.commit()
cache.commit() cache.commit()
@ -1706,11 +1705,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:

View File

@ -1203,6 +1203,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