rust/hg-cpython/src/dirstate/dirstate_map.rs
changeset 47351 3b9914b28133
parent 47335 ed1583a845d2
child 47477 eb416759af7e
--- a/rust/hg-cpython/src/dirstate/dirstate_map.rs	Mon May 31 18:35:44 2021 +0200
+++ b/rust/hg-cpython/src/dirstate/dirstate_map.rs	Mon May 31 19:54:41 2021 +0200
@@ -535,6 +535,18 @@
         )
     }
 
+    def directories(&self) -> PyResult<PyList> {
+        let dirs = PyList::new(py, &[]);
+        for item in self.inner(py).borrow().iter_directories() {
+            let (path, mtime) = item.map_err(|e| v2_error(py, e))?;
+            let path = PyBytes::new(py, path.as_bytes());
+            let mtime = mtime.map(|t| t.0).unwrap_or(-1);
+            let tuple = (path, (b'd', 0, 0, mtime));
+            dirs.append(py, tuple.to_py_object(py).into_object())
+        }
+        Ok(dirs)
+    }
+
 });
 
 impl DirstateMap {