diff rust/hg-core/src/dirstate/dirstate_map.rs @ 44416:8ac5726d695d

rust-cpython: make `NonNormalEntires` iterable to fix `fsmonitor` (issue6276) This fixes a bug when using `fsmonitor` that tries to iterate on the non normal set, by adding a shared iterator interface. Differential Revision: https://phab.mercurial-scm.org/D8143
author Raphaël Gomès <rgomes@octobus.net>
date Mon, 24 Feb 2020 17:57:57 +0100
parents c089a0947f3e
children 26114bd6ec60
line wrap: on
line diff
--- a/rust/hg-core/src/dirstate/dirstate_map.rs	Sat Sep 07 14:50:39 2019 +0200
+++ b/rust/hg-core/src/dirstate/dirstate_map.rs	Mon Feb 24 17:57:57 2020 +0100
@@ -237,6 +237,25 @@
         )
     }
 
+    /// Useful to get immutable references to those sets in contexts where
+    /// you only have an immutable reference to the `DirstateMap`, like when
+    /// sharing references with Python.
+    ///
+    /// TODO, get rid of this along with the other "setter/getter" stuff when
+    /// a nice typestate plan is defined.
+    ///
+    /// # Panics
+    ///
+    /// Will panic if either set is `None`.
+    pub fn get_non_normal_other_parent_entries_panic(
+        &self,
+    ) -> (&HashSet<HgPathBuf>, &HashSet<HgPathBuf>) {
+        (
+            self.non_normal_set.as_ref().unwrap(),
+            self.other_parent_set.as_ref().unwrap(),
+        )
+    }
+
     pub fn set_non_normal_other_parent_entries(&mut self, force: bool) {
         if !force
             && self.non_normal_set.is_some()