rust/hg-core/src/dirstate_tree/dirstate_map.rs
changeset 47351 3b9914b28133
parent 47349 7138c863d0a1
child 47352 9d58e54b5966
--- a/rust/hg-core/src/dirstate_tree/dirstate_map.rs	Mon May 31 18:35:44 2021 +0200
+++ b/rust/hg-core/src/dirstate_tree/dirstate_map.rs	Mon May 31 19:54:41 2021 +0200
@@ -319,7 +319,7 @@
 
     pub(super) fn cached_directory_mtime(
         &self,
-    ) -> Option<&on_disk::Timestamp> {
+    ) -> Option<&'tree on_disk::Timestamp> {
         match self {
             NodeRef::InMemory(_path, node) => match &node.data {
                 NodeData::CachedDirectory { mtime } => Some(mtime),
@@ -1068,4 +1068,28 @@
             })
         }))
     }
+
+    fn iter_directories(
+        &self,
+    ) -> Box<
+        dyn Iterator<
+                Item = Result<
+                    (&HgPath, Option<Timestamp>),
+                    DirstateV2ParseError,
+                >,
+            > + Send
+            + '_,
+    > {
+        Box::new(filter_map_results(self.iter_nodes(), move |node| {
+            Ok(if node.state()?.is_none() {
+                Some((
+                    node.full_path(self.on_disk)?,
+                    node.cached_directory_mtime()
+                        .map(|mtime| Timestamp(mtime.seconds())),
+                ))
+            } else {
+                None
+            })
+        }))
+    }
 }