mirror of https://github.com/restic/restic.git
restic diff, stats, tag - more command which vannot handle partial snapshots
inserted check for partial snapshots
This commit is contained in:
parent
1873780d41
commit
be6a144503
|
@ -74,6 +74,10 @@ func loadSnapshot(ctx context.Context, be restic.Lister, repo restic.LoaderUnpac
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, "", errors.Fatal(err.Error())
|
return nil, "", errors.Fatal(err.Error())
|
||||||
}
|
}
|
||||||
|
err = checkPartialSnapshot(sn, "fatal", "diff")
|
||||||
|
if err != nil {
|
||||||
|
return sn, "", err
|
||||||
|
}
|
||||||
return sn, subfolder, err
|
return sn, subfolder, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -29,13 +29,13 @@ func newStatsCommand() *cobra.Command {
|
||||||
Short: "Scan the repository and show basic statistics",
|
Short: "Scan the repository and show basic statistics",
|
||||||
Long: `
|
Long: `
|
||||||
The "stats" command walks one or multiple snapshots in a repository
|
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
|
on the number of unique files and their sizes, according to one of
|
||||||
the counting modes as given by the --mode flag.
|
the counting modes as given by the --mode flag.
|
||||||
|
|
||||||
It operates on all snapshots matching the selection criteria or all
|
It operates on all snapshots matching the selection criteria or all
|
||||||
snapshots if nothing is specified. The special snapshot ID "latest"
|
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,
|
just a single snapshot, while others are useful across all snapshots,
|
||||||
depending on what you are trying to calculate.
|
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) {
|
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)
|
err = statsWalkSnapshot(ctx, sn, repo, opts, stats)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("error walking snapshot: %v", err)
|
return fmt.Errorf("error walking snapshot: %v", err)
|
||||||
|
|
|
@ -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) {
|
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)
|
changed, err := changeTags(ctx, repo, sn, opts.SetTags.Flatten(), opts.AddTags.Flatten(), opts.RemoveTags.Flatten(), printFunc)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
Warnf("unable to modify the tags for snapshot ID %q, ignoring: %v\n", sn.ID(), err)
|
Warnf("unable to modify the tags for snapshot ID %q, ignoring: %v\n", sn.ID(), err)
|
||||||
|
|
Loading…
Reference in New Issue