1
0
Fork 0
mirror of https://github.com/borgbackup/borg.git synced 2024-12-25 01:06:50 +00:00

Merge pull request #7320 from ThomasWaldmann/transfer-progress

Transfer progress
This commit is contained in:
TW 2023-02-03 03:06:32 +01:00 committed by GitHub
commit 7ffd87739b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -86,7 +86,9 @@ def do_transfer(self, args, *, repository, manifest, cache, other_repository=Non
if not dry_run: if not dry_run:
print(f"{name}: copying archive to destination repo...") print(f"{name}: copying archive to destination repo...")
other_archive = Archive(other_manifest, name) other_archive = Archive(other_manifest, name)
archive = Archive(manifest, name, cache=cache, create=True) if not dry_run else None archive = (
Archive(manifest, name, cache=cache, create=True, progress=args.progress) if not dry_run else None
)
upgrader.new_archive(archive=archive) upgrader.new_archive(archive=archive)
for item in other_archive.iter_items(): for item in other_archive.iter_items():
is_part = bool(item.get("part", False)) is_part = bool(item.get("part", False))
@ -130,7 +132,10 @@ def do_transfer(self, args, *, repository, manifest, cache, other_repository=Non
item.chunks = chunks # TODO: overwrite? IDs and sizes are same. item.chunks = chunks # TODO: overwrite? IDs and sizes are same.
archive.stats.nfiles += 1 archive.stats.nfiles += 1
if not dry_run: if not dry_run:
archive.add_item(upgrader.upgrade_item(item=item)) item = upgrader.upgrade_item(item=item)
archive.add_item(item, show_progress=args.progress)
if args.progress:
archive.stats.show_progress(final=True)
if not dry_run: if not dry_run:
additional_metadata = upgrader.upgrade_archive_metadata(metadata=other_archive.metadata) additional_metadata = upgrader.upgrade_archive_metadata(metadata=other_archive.metadata)
archive.save(additional_metadata=additional_metadata) archive.save(additional_metadata=additional_metadata)