changeset 47897:4f0ebf83e4dc

dirstatemap: conclude `reset_state` with logic using the new __init__ Now the DirstateItem can deal with most of the logic related to its initialization, our goal is to migrate the function to a more "unified" way were minimal processing is done early before more generic code gets into play. Nobody is calling this code yet, but this is about to change. Differential Revision: https://phab.mercurial-scm.org/D11322
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Fri, 16 Jul 2021 17:03:39 +0200
parents d5b54917eb92
children 442711f2c447
files mercurial/dirstatemap.py
diffstat 1 files changed, 22 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/dirstatemap.py	Fri Jul 16 16:29:16 2021 +0200
+++ b/mercurial/dirstatemap.py	Fri Jul 16 17:03:39 2021 +0200
@@ -313,6 +313,28 @@
         else:
             assert False, 'unreachable'
 
+        old_entry = self._map.get(filename)
+        self._dirs_incr(filename, old_entry)
+        entry = DirstateItem(
+            wc_tracked=wc_tracked,
+            p1_tracked=p1_tracked,
+            p2_tracked=p2_tracked,
+            merged=merged,
+            clean_p1=clean_p1,
+            clean_p2=clean_p2,
+            possibly_dirty=possibly_dirty,
+            parentfiledata=parentfiledata,
+        )
+        if entry.dm_nonnormal:
+            self.nonnormalset.add(filename)
+        else:
+            self.nonnormalset.discard(filename)
+        if entry.dm_otherparent:
+            self.otherparentset.add(filename)
+        else:
+            self.otherparentset.discard(filename)
+        self._map[filename] = entry
+
     def set_untracked(self, f):
         """Mark a file as no longer tracked in the dirstate map"""
         entry = self[f]