From 06ee0339aa458ca0b8ee5990413bad7e984d7375 Mon Sep 17 00:00:00 2001 From: sedlund Date: Sat, 3 Dec 2022 09:21:09 +0800 Subject: [PATCH 1/2] fix#4033 cmd: copy no longer lists skipped existing snapshots by default --- changelog/unreleased/issue-4033 | 20 ++++++++++++++++++++ cmd/restic/cmd_copy.go | 5 +++-- 2 files changed, 23 insertions(+), 2 deletions(-) create mode 100644 changelog/unreleased/issue-4033 diff --git a/changelog/unreleased/issue-4033 b/changelog/unreleased/issue-4033 new file mode 100644 index 000000000..1f356caaa --- /dev/null +++ b/changelog/unreleased/issue-4033 @@ -0,0 +1,20 @@ +# The first line must start with Bugfix:, Enhancement: or Change:, +# including the colon. Use present tense. Remove lines starting with '#' +# from this template. +Change: copy command no longer prints skipped existing snapshots by default + +# Describe the problem in the past tense, the new behavior in the present +# tense. Mention the affected commands, backends, operating systems, etc. +# Focus on user-facing behavior, not the implementation. + +Restic copy always printed each skipped snapshot that existed on the remote and +would bury the snapshots that were copied amongst the output. The new default +only outputs new copies. Increase the verbose level to see skipped existing +snapshots. + +# The last section is a list of issue, PR and forum URLs. +# The first issue ID determines the filename for the changelog entry: +# changelog/unreleased/issue-1234. If there are no relevant issue links, +# use the PR ID and call the file pull-55555. + +https://github.com/restic/restic/issues/4033 diff --git a/cmd/restic/cmd_copy.go b/cmd/restic/cmd_copy.go index 08df7e8a7..14ab1917a 100644 --- a/cmd/restic/cmd_copy.go +++ b/cmd/restic/cmd_copy.go @@ -120,7 +120,6 @@ func runCopy(ctx context.Context, opts CopyOptions, gopts GlobalOptions, args [] visitedTrees := restic.NewIDSet() for sn := range FindFilteredSnapshots(ctx, srcSnapshotLister, srcRepo, opts.Hosts, opts.Tags, opts.Paths, args) { - Verbosef("\nsnapshot %s of %v at %s)\n", sn.ID().Str(), sn.Paths, sn.Time) // check whether the destination has a snapshot with the same persistent ID which has similar snapshot fields srcOriginal := *sn.ID() @@ -131,7 +130,8 @@ func runCopy(ctx context.Context, opts CopyOptions, gopts GlobalOptions, args [] isCopy := false for _, originalSn := range originalSns { if similarSnapshots(originalSn, sn) { - Verbosef("skipping source snapshot %s, was already copied to snapshot %s\n", sn.ID().Str(), originalSn.ID().Str()) + Verboseff("\nsnapshot %s of %v at %s)\n", sn.ID().Str(), sn.Paths, sn.Time) + Verboseff("skipping source snapshot %s, was already copied to snapshot %s\n", sn.ID().Str(), originalSn.ID().Str()) isCopy = true break } @@ -140,6 +140,7 @@ func runCopy(ctx context.Context, opts CopyOptions, gopts GlobalOptions, args [] continue } } + Verbosef("\nsnapshot %s of %v at %s)\n", sn.ID().Str(), sn.Paths, sn.Time) Verbosef(" copy started, this may take a while...\n") if err := copyTree(ctx, srcRepo, dstRepo, visitedTrees, *sn.Tree, gopts.Quiet); err != nil { return err From cbe73ace3f5ab7beab6fe97309924b124a8ec15e Mon Sep 17 00:00:00 2001 From: Scott Edlund Date: Sat, 3 Dec 2022 20:07:37 +0800 Subject: [PATCH 2/2] Update changelog/unreleased/issue-4033 Co-authored-by: greatroar <61184462+greatroar@users.noreply.github.com> --- changelog/unreleased/issue-4033 | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/changelog/unreleased/issue-4033 b/changelog/unreleased/issue-4033 index 1f356caaa..87c1ff255 100644 --- a/changelog/unreleased/issue-4033 +++ b/changelog/unreleased/issue-4033 @@ -1,20 +1,9 @@ -# The first line must start with Bugfix:, Enhancement: or Change:, -# including the colon. Use present tense. Remove lines starting with '#' -# from this template. Change: copy command no longer prints skipped existing snapshots by default -# Describe the problem in the past tense, the new behavior in the present -# tense. Mention the affected commands, backends, operating systems, etc. -# Focus on user-facing behavior, not the implementation. - Restic copy always printed each skipped snapshot that existed on the remote and would bury the snapshots that were copied amongst the output. The new default only outputs new copies. Increase the verbose level to see skipped existing snapshots. -# The last section is a list of issue, PR and forum URLs. -# The first issue ID determines the filename for the changelog entry: -# changelog/unreleased/issue-1234. If there are no relevant issue links, -# use the PR ID and call the file pull-55555. - https://github.com/restic/restic/issues/4033 +https://github.com/restic/restic/pull/4066