diff rust/hg-core/src/dirstate/dirstate_map.rs @ 47524:69a463a4f193

dirstate: no longer pass the `oldstate` value to the dirstatemap The dirstatemap already have this information. Differential Revision: https://phab.mercurial-scm.org/D10966
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Sat, 03 Jul 2021 20:59:26 +0200
parents abed645b8e96
children fe4641cf9b72
line wrap: on
line diff
--- a/rust/hg-core/src/dirstate/dirstate_map.rs	Sat Jul 03 20:57:44 2021 +0200
+++ b/rust/hg-core/src/dirstate/dirstate_map.rs	Sat Jul 03 20:59:26 2021 +0200
@@ -68,7 +68,6 @@
     pub fn add_file(
         &mut self,
         filename: &HgPath,
-        old_state: EntryState,
         entry: DirstateEntry,
         // XXX once the dust settle this should probably become an enum
         from_p2: bool,
@@ -91,7 +90,10 @@
             entry.size = entry.size & V1_RANGEMASK;
             entry.mtime = entry.mtime & V1_RANGEMASK;
         }
-
+        let old_state = match self.get(filename) {
+            Some(e) => e.state,
+            None => EntryState::Unknown,
+        };
         if old_state == EntryState::Unknown || old_state == EntryState::Removed
         {
             if let Some(ref mut dirs) = self.dirs {
@@ -397,7 +399,6 @@
 
         map.add_file(
             HgPath::new(b"meh"),
-            EntryState::Normal,
             DirstateEntry {
                 state: EntryState::Normal,
                 mode: 1337,