dirstate: infer the 'n' state from `possibly_dirty`
authorPierre-Yves David <pierre-yves.david@octobus.net>
Sun, 04 Jul 2021 01:57:28 +0200
changeset 47528 80617f3c0f9a
parent 47527 c6b91a9c242a
child 47529 d3cf20328abd
dirstate: infer the 'n' state from `possibly_dirty` This flag is only used with 'n' so lets set the state based on that parameter in this case. Differential Revision: https://phab.mercurial-scm.org/D10970
mercurial/dirstate.py
mercurial/dirstatemap.py
rust/hg-core/src/dirstate/dirstate_map.rs
rust/hg-core/src/dirstate_tree/dirstate_map.rs
--- a/mercurial/dirstate.py	Sun Jul 04 01:48:11 2021 +0200
+++ b/mercurial/dirstate.py	Sun Jul 04 01:57:28 2021 +0200
@@ -530,7 +530,7 @@
                     return
                 elif entry.merged or entry.from_p2:
                     return
-        self._addpath(f, b'n', 0, possibly_dirty=True)
+        self._addpath(f, possibly_dirty=True)
         self._map.copymap.pop(f, None)
 
     def otherparent(self, f):
--- a/mercurial/dirstatemap.py	Sun Jul 04 01:48:11 2021 +0200
+++ b/mercurial/dirstatemap.py	Sun Jul 04 01:57:28 2021 +0200
@@ -175,6 +175,7 @@
             size = FROM_P2
             mtime = AMBIGUOUS_TIME
         elif possibly_dirty:
+            state = b'n'
             size = NONNORMAL
             mtime = AMBIGUOUS_TIME
         else:
--- a/rust/hg-core/src/dirstate/dirstate_map.rs	Sun Jul 04 01:48:11 2021 +0200
+++ b/rust/hg-core/src/dirstate/dirstate_map.rs	Sun Jul 04 01:57:28 2021 +0200
@@ -94,6 +94,7 @@
             entry.size = SIZE_FROM_OTHER_PARENT;
             entry.mtime = MTIME_UNSET;
         } else if possibly_dirty {
+            entry.state = EntryState::Normal;
             entry.size = SIZE_NON_NORMAL;
             entry.mtime = MTIME_UNSET;
         } else {
--- a/rust/hg-core/src/dirstate_tree/dirstate_map.rs	Sun Jul 04 01:48:11 2021 +0200
+++ b/rust/hg-core/src/dirstate_tree/dirstate_map.rs	Sun Jul 04 01:57:28 2021 +0200
@@ -745,6 +745,7 @@
             entry.size = SIZE_FROM_OTHER_PARENT;
             entry.mtime = MTIME_UNSET;
         } else if possibly_dirty {
+            entry.state = EntryState::Normal;
             entry.size = SIZE_NON_NORMAL;
             entry.mtime = MTIME_UNSET;
         } else {