diff --git a/src/restic/snapshot.go b/src/restic/snapshot.go index 6b4e87298..3cf8daedd 100644 --- a/src/restic/snapshot.go +++ b/src/restic/snapshot.go @@ -60,6 +60,22 @@ func LoadSnapshot(repo *repository.Repository, id backend.ID) (*Snapshot, error) return sn, nil } +func LoadAllSnapshots(repo *repository.Repository) (snapshots []*Snapshot, err error) { + done := make(chan struct{}) + defer close(done) + + for id := range repo.List(backend.Snapshot, done) { + sn, err := LoadSnapshot(repo, id) + if err != nil { + return nil, err + } + + snapshots = append(snapshots, sn) + } + + return snapshots, nil +} + func (sn Snapshot) String() string { return fmt.Sprintf("", sn.Paths, sn.Time) }