restic copy --batch: a fresh start from commit 382616747

Instead of rebasing my code, I decided to start fresh, since WithBlobUploader()
has been introduced.

changelog/unreleased/issue-5453:
doc/045_working_with_repos.rst:
the usual

cmd/restic/cmd_copy.go:
gather all snaps to be collected - collectAllSnapshots()
run overall copy step - func copyTreeBatched()
helper copySaveSnapshot() to save the corresponding snapshot

internal/repository/repack.go:
introduce wrapper CopyBlobs(), which passes parameter `uploader restic.BlobSaver` from
WithBlobUploader() via copyTreeBatched() to repack().

internal/backend/local/local_windows.go:
I did not touch it, but gofmt did: whitespace
This commit is contained in:
Winfried Plappert
2025-11-19 07:09:24 +00:00
parent 3826167474
commit b87f7586e4
6 changed files with 370 additions and 24 deletions
+20
View File
@@ -54,6 +54,26 @@ func Repack(
})
}
/* the following code is a terrible hack, but there is currently no other way
of calling the functionality in repack() without a lot duplication of code.
Repack() is still called from `restic prune` via plan.Execute() inside prune.go
*/
// CopyBlobs is a wrapper around repack(). The parameter 'uploader' is passed through
// from WithBlobUploader() to CopyBlobs() via cmd/restic/cmd_copy.copyTree().
func CopyBlobs(
ctx context.Context,
repo restic.Repository,
dstRepo restic.Repository,
uploader restic.BlobSaver,
packs restic.IDSet,
keepBlobs repackBlobSet,
p *progress.Counter,
logf LogFunc,
) error {
return repack(ctx, repo, dstRepo, uploader, packs, keepBlobs, p, logf)
}
func repack(
ctx context.Context,
repo restic.Repository,