From f9e5660e75de02e1a0b1fddec58470864d5a2ef3 Mon Sep 17 00:00:00 2001 From: Michael Eischer Date: Sun, 23 Nov 2025 22:01:53 +0100 Subject: [PATCH] output which source and target snapshot belong together --- cmd/restic/cmd_copy.go | 6 +++++- doc/045_working_with_repos.rst | 13 ++++++++++--- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/cmd/restic/cmd_copy.go b/cmd/restic/cmd_copy.go index 948782f82..bf86de8a7 100644 --- a/cmd/restic/cmd_copy.go +++ b/cmd/restic/cmd_copy.go @@ -225,6 +225,10 @@ func copyTreeBatched(ctx context.Context, srcRepo restic.Repository, dstRepo res return err } + // add a newline to separate saved snapshot messages from the other messages + if len(batch) > 1 { + printer.P("") + } // save all the snapshots for _, sn := range batch { err := copySaveSnapshot(ctx, sn, dstRepo, printer) @@ -322,6 +326,6 @@ func copySaveSnapshot(ctx context.Context, sn *data.Snapshot, dstRepo restic.Rep if err != nil { return err } - printer.P("snapshot %s saved", newID.Str()) + printer.P("snapshot %s saved, copied from source snapshot %s", newID.Str(), sn.ID().Str()) return nil } diff --git a/doc/045_working_with_repos.rst b/doc/045_working_with_repos.rst index 5fadac637..797ea9f9d 100644 --- a/doc/045_working_with_repos.rst +++ b/doc/045_working_with_repos.rst @@ -205,21 +205,28 @@ example from a local to a remote repository, you can use the ``copy`` command: .. code-block:: console - $ restic -r /srv/restic-repo-copy copy --from-repo /srv/restic-repo + $ restic -r /srv/restic-repo-copy copy --from-repo /srv/restic-repo --verbose repository d6504c63 opened successfully repository 3dd0878c opened successfully + [0:00] 100.00% 2 / 2 index files loaded + [0:00] 100.00% 7 / 7 index files loaded snapshot 410b18a2 of [/home/user/work] at 2020-06-09 23:15:57.305305 +0200 CEST by user@kasimir copy started, this may take a while... - snapshot 7a746a07 saved + [0:00] 100.00% 13 / 13 packs copied snapshot 4e5d5487 of [/home/user/work] at 2020-05-01 22:44:07.012113 +0200 CEST by user@kasimir skipping snapshot 4e5d5487, was already copied to snapshot 50eb62b7 + snapshot 7a746a07 saved, copied from source snapshot 410b18a2 + The example command copies all snapshots from the source repository ``/srv/restic-repo`` to the destination repository ``/srv/restic-repo-copy``. Snapshots which have previously been copied between repositories will -be skipped by later copy runs. +be skipped by later copy runs. Information about skipped snapshots is only +printed when ``--verbose`` is passed to the command. For efficiency reasons, +the snapshots are copied in batches, such that the ``snapshot [...] saved`` +messages can appear some time after the snapshot content was copied. .. important:: This process will have to both download (read) and upload (write) the entire snapshot(s) due to the different encryption keys used in the