Merge pull request #2400 from ThomasWaldmann/rename-with-placeholders-1.0

borg rename: expand placeholders, fixes #2386
This commit is contained in:
TW 2017-04-09 20:48:05 +02:00 committed by GitHub
commit 1cf4740c59
1 changed files with 4 additions and 2 deletions

View File

@ -24,7 +24,8 @@ from .helpers import Error, location_validator, archivename_validator, format_li
PathPrefixPattern, to_localtime, timestamp, safe_timestamp, bin_to_hex, get_cache_dir, prune_within, prune_split, \ PathPrefixPattern, to_localtime, timestamp, safe_timestamp, bin_to_hex, get_cache_dir, prune_within, prune_split, \
Manifest, NoManifestError, remove_surrogates, format_archive, check_extension_modules, Statistics, \ Manifest, NoManifestError, remove_surrogates, format_archive, check_extension_modules, Statistics, \
dir_is_tagged, bigint_to_int, ChunkerParams, CompressionSpec, PrefixSpec, is_slow_msgpack, yes, sysinfo, \ dir_is_tagged, bigint_to_int, ChunkerParams, CompressionSpec, PrefixSpec, is_slow_msgpack, yes, sysinfo, \
EXIT_SUCCESS, EXIT_WARNING, EXIT_ERROR, log_multi, PatternMatcher, ErrorIgnoringTextIOWrapper, set_ec EXIT_SUCCESS, EXIT_WARNING, EXIT_ERROR, log_multi, PatternMatcher, ErrorIgnoringTextIOWrapper, set_ec, \
replace_placeholders
from .helpers import signal_handler, raising_signal_handler, SigHup, SigTerm from .helpers import signal_handler, raising_signal_handler, SigHup, SigTerm
from .logger import create_logger, setup_logging from .logger import create_logger, setup_logging
logger = create_logger() logger = create_logger()
@ -494,7 +495,8 @@ 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"""
archive.rename(args.name) name = replace_placeholders(args.name)
archive.rename(name)
manifest.write() manifest.write()
repository.commit() repository.commit()
cache.commit() cache.commit()