mirror of
https://github.com/borgbackup/borg.git
synced 2025-02-23 06:31:58 +00:00
recreate: remove special-cased --dry-run
This commit is contained in:
parent
c6f0969352
commit
30df63c509
2 changed files with 8 additions and 13 deletions
|
@ -1394,10 +1394,6 @@ def finish(self, save_space=False):
|
|||
|
||||
|
||||
class ArchiveRecreater:
|
||||
class FakeTargetArchive:
|
||||
def __init__(self):
|
||||
self.stats = Statistics()
|
||||
|
||||
class Interrupted(Exception):
|
||||
def __init__(self, metadata=None):
|
||||
self.metadata = metadata or {}
|
||||
|
@ -1434,7 +1430,7 @@ def __init__(self, repository, manifest, key, cache, matcher,
|
|||
self.stats = stats
|
||||
self.progress = progress
|
||||
self.print_file_status = file_status_printer or (lambda *args: None)
|
||||
self.checkpoint_interval = checkpoint_interval
|
||||
self.checkpoint_interval = None if dry_run else checkpoint_interval
|
||||
|
||||
def recreate(self, archive_name, comment=None, target_name=None):
|
||||
assert not self.is_temporary_archive(archive_name)
|
||||
|
@ -1444,7 +1440,7 @@ def recreate(self, archive_name, comment=None, target_name=None):
|
|||
self.matcher_add_tagged_dirs(archive)
|
||||
if self.matcher.empty() and not self.recompress and not target.recreate_rechunkify and comment is None:
|
||||
logger.info("Skipping archive %s, nothing to do", archive_name)
|
||||
return True
|
||||
return
|
||||
self.process_items(archive, target)
|
||||
replace_original = target_name is None
|
||||
self.save(archive, target, comment, replace_original=replace_original)
|
||||
|
@ -1588,8 +1584,6 @@ def exclude(dir, tag_item):
|
|||
|
||||
def create_target(self, archive, target_name=None):
|
||||
"""Create target archive."""
|
||||
if self.dry_run:
|
||||
return self.FakeTargetArchive(), None
|
||||
target_name = target_name or archive.name + '.recreate'
|
||||
target = self.create_target_archive(target_name)
|
||||
# If the archives use the same chunker params, then don't rechunkify
|
||||
|
|
|
@ -1102,9 +1102,10 @@ def do_recreate(self, args, repository, manifest, key, cache):
|
|||
continue
|
||||
print('Processing', name)
|
||||
recreater.recreate(name, args.comment)
|
||||
manifest.write()
|
||||
repository.commit()
|
||||
cache.commit()
|
||||
if not args.dry_run:
|
||||
manifest.write()
|
||||
repository.commit()
|
||||
cache.commit()
|
||||
return self.exit_code
|
||||
|
||||
@with_repository(manifest=False, exclusive=True)
|
||||
|
@ -2387,8 +2388,8 @@ def build_parser(self, prog=None):
|
|||
|
||||
When rechunking space usage can be substantial, expect at least the entire
|
||||
deduplicated size of the archives using the previous chunker params.
|
||||
When recompressing approximately 1 % of the repository size or 512 MB
|
||||
(whichever is greater) of additional space is used.
|
||||
When recompressing expect approx throughput / checkpoint-interval in space usage,
|
||||
assuming all chunks are recompressed.
|
||||
""")
|
||||
subparser = subparsers.add_parser('recreate', parents=[common_parser], add_help=False,
|
||||
description=self.do_recreate.__doc__,
|
||||
|
|
Loading…
Reference in a new issue