1
0
Fork 0
mirror of https://github.com/borgbackup/borg.git synced 2024-12-27 10:18:12 +00:00

Merge pull request #3883 from saurvs/prune_forwardport

borg prune: improve progress display (fwd port to master)
This commit is contained in:
TW 2018-06-09 22:39:03 +02:00 committed by GitHub
commit ceaa7e9210
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1363,15 +1363,16 @@ def do_prune(self, args, repository, manifest, key):
# set up counters for the progress display
to_delete_len = len(to_delete)
archives_deleted = 0
pi = ProgressIndicatorPercent(total=len(to_delete), msg='Pruning archives %3.0f%%', msgid='prune')
for archive in archives_checkpoints:
if archive in to_delete:
pi.show()
if args.dry_run:
log_message = 'Would prune:'
else:
archives_deleted += 1
log_message = 'Pruning archive (%d/%d):' % (archives_deleted, to_delete_len)
Archive(repository, key, manifest, archive.name, cache,
progress=args.progress).delete(stats, forced=args.forced)
Archive(repository, key, manifest, archive.name, cache).delete(stats, forced=args.forced)
else:
if is_checkpoint(archive.name):
log_message = 'Keeping checkpoint archive:'
@ -1383,6 +1384,7 @@ def do_prune(self, args, repository, manifest, key):
list_logger.info("{message:<40} {archive}".format(
message=log_message, archive=format_archive(archive)
))
pi.finish()
if to_delete and not args.dry_run:
manifest.write()
repository.commit(save_space=args.save_space)