mirror of
https://github.com/restic/restic.git
synced 2025-08-22 01:51:47 +00:00
Make realistic forget --prune --dryrun
This commit is contained in:

committed by
Alexander Neumann

parent
7f9a0a5907
commit
b2f5381737
@@ -67,8 +67,12 @@ func LoadSnapshot(ctx context.Context, repo Repository, id ID) (*Snapshot, error
|
||||
}
|
||||
|
||||
// LoadAllSnapshots returns a list of all snapshots in the repo.
|
||||
func LoadAllSnapshots(ctx context.Context, repo Repository) (snapshots []*Snapshot, err error) {
|
||||
// If a snapshot ID is in excludeIDs, it will not be included in the result.
|
||||
func LoadAllSnapshots(ctx context.Context, repo Repository, excludeIDs IDSet) (snapshots []*Snapshot, err error) {
|
||||
err = repo.List(ctx, SnapshotFile, func(id ID, size int64) error {
|
||||
if excludeIDs.Has(id) {
|
||||
return nil
|
||||
}
|
||||
sn, err := LoadSnapshot(ctx, repo, id)
|
||||
if err != nil {
|
||||
return err
|
||||
|
@@ -25,7 +25,7 @@ func TestCreateSnapshot(t *testing.T) {
|
||||
restic.TestCreateSnapshot(t, repo, testSnapshotTime.Add(time.Duration(i)*time.Second), testDepth, 0)
|
||||
}
|
||||
|
||||
snapshots, err := restic.LoadAllSnapshots(context.TODO(), repo)
|
||||
snapshots, err := restic.LoadAllSnapshots(context.TODO(), repo, restic.NewIDSet())
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
Reference in New Issue
Block a user