@@ -938,7 +938,7 @@ impl<P: ProgressBars, S: Open> Repository<P, S> {
938938 & self ,
939939 ids : & [ String ] ,
940940 group_by : SnapshotGroupCriterion ,
941- filter : impl FnMut ( & SnapshotFile ) -> bool ,
941+ filter : impl FnMut ( & SnapshotFile ) -> bool + Send + Sync ,
942942 ) -> RusticResult < Vec < ( SnapshotGroup , Vec < SnapshotFile > ) > > {
943943 commands:: snapshots:: get_snapshot_group ( self , ids, group_by, filter)
944944 }
@@ -959,7 +959,7 @@ impl<P: ProgressBars, S: Open> Repository<P, S> {
959959 /// # Returns
960960 ///
961961 /// If `id` is (part of) an `Id`, return this snapshot.
962- /// If `id` is "latest", return the latest snapshot respecting the giving filter.
962+ /// If `id` is "latest" or "latest~N" , return the latest (or Nth latest) snapshot respecting the giving filter.
963963 pub fn get_snapshot_from_str (
964964 & self ,
965965 id : & str ,
@@ -971,6 +971,35 @@ impl<P: ProgressBars, S: Open> Repository<P, S> {
971971 Ok ( snap)
972972 }
973973
974+ /// Get a single snapshot
975+ ///
976+ /// # Arguments
977+ ///
978+ /// * `ids` - The ids of the snapshot to get
979+ /// * each `id` can use an actual (short) id "01a2b3c4" or "latest" or "latest~N"
980+ /// * `filter` - The filter to use
981+ ///
982+ /// # Errors
983+ ///
984+ /// * If the string is not a valid hexadecimal string
985+ /// * If no id could be found.
986+ /// * If the id is not unique.
987+ ///
988+ /// # Returns
989+ ///
990+ /// If `id` is (part of) an `Id`, return this snapshot.
991+ /// If `id` is "latest" or "latest~N", return the latest (or Nth latest) snapshot respecting the giving filter.
992+ pub fn get_snapshots_from_strs < T : AsRef < str > > (
993+ & self ,
994+ ids : & [ T ] ,
995+ filter : impl FnMut ( & SnapshotFile ) -> bool + Send + Sync ,
996+ ) -> RusticResult < Vec < SnapshotFile > > {
997+ let p = self . pb . progress_counter ( "getting snapshots..." ) ;
998+ let snaps = SnapshotFile :: from_strs ( self . dbe ( ) , ids, filter, & p) ?;
999+ p. finish ( ) ;
1000+ Ok ( snaps)
1001+ }
1002+
9741003 /// Get the given snapshots.
9751004 ///
9761005 /// # Arguments
@@ -1104,7 +1133,7 @@ impl<P: ProgressBars, S: Open> Repository<P, S> {
11041133 & self ,
11051134 keep : & KeepOptions ,
11061135 group_by : SnapshotGroupCriterion ,
1107- filter : impl FnMut ( & SnapshotFile ) -> bool ,
1136+ filter : impl FnMut ( & SnapshotFile ) -> bool + Send + Sync ,
11081137 ) -> RusticResult < ForgetGroups > {
11091138 commands:: forget:: get_forget_snapshots ( self , keep, group_by, filter)
11101139 }
0 commit comments