restic diff, stats, tag - more command which vannot handle partial snapshots

inserted check for partial snapshots
This commit is contained in:
Winfried Plappert 2025-03-05 21:44:34 +00:00
parent 1873780d41
commit be6a144503
3 changed files with 14 additions and 2 deletions

View File

@ -74,6 +74,10 @@ func loadSnapshot(ctx context.Context, be restic.Lister, repo restic.LoaderUnpac
if err != nil {
return nil, "", errors.Fatal(err.Error())
}
err = checkPartialSnapshot(sn, "fatal", "diff")
if err != nil {
return sn, "", err
}
return sn, subfolder, err
}

View File

@ -29,13 +29,13 @@ func newStatsCommand() *cobra.Command {
Short: "Scan the repository and show basic statistics",
Long: `
The "stats" command walks one or multiple snapshots in a repository
and accumulates statistics about the data stored therein. It reports
and accumulates statistics about the data stored therein. It reports
on the number of unique files and their sizes, according to one of
the counting modes as given by the --mode flag.
It operates on all snapshots matching the selection criteria or all
snapshots if nothing is specified. The special snapshot ID "latest"
is also supported. Some modes make more sense over
is also supported. Some modes make more sense over
just a single snapshot, while others are useful across all snapshots,
depending on what you are trying to calculate.
@ -130,6 +130,10 @@ func runStats(ctx context.Context, opts StatsOptions, gopts GlobalOptions, args
}
for sn := range FindFilteredSnapshots(ctx, snapshotLister, repo, &opts.SnapshotFilter, args) {
err = checkPartialSnapshot(sn, "fatal", "stats")
if err != nil {
return err
}
err = statsWalkSnapshot(ctx, sn, repo, opts, stats)
if err != nil {
return fmt.Errorf("error walking snapshot: %v", err)

View File

@ -157,6 +157,10 @@ func runTag(ctx context.Context, opts TagOptions, gopts GlobalOptions, term *ter
}
for sn := range FindFilteredSnapshots(ctx, repo, repo, &opts.SnapshotFilter, args) {
err := checkPartialSnapshot(sn, "fatal", "tag")
if err != nil {
return err
}
changed, err := changeTags(ctx, repo, sn, opts.SetTags.Flatten(), opts.AddTags.Flatten(), opts.RemoveTags.Flatten(), printFunc)
if err != nil {
Warnf("unable to modify the tags for snapshot ID %q, ignoring: %v\n", sn.ID(), err)