Patchwork D11322: dirstatemap: conclude `reset_state` with logic using the new __init__

login
register
mail settings
Submitter phabricator
Date Aug. 21, 2021, 9:56 a.m.
Message ID <differential-rev-PHID-DREV-wxw3nxrlvvmptw53jykh-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/49634/
State Superseded
Headers show

Comments

phabricator - Aug. 21, 2021, 9:56 a.m.
marmoute created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  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.

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D11322

AFFECTED FILES
  mercurial/dirstatemap.py

CHANGE DETAILS




To: marmoute, #hg-reviewers
Cc: mercurial-patches, mercurial-devel

Patch

diff --git a/mercurial/dirstatemap.py b/mercurial/dirstatemap.py
--- a/mercurial/dirstatemap.py
+++ b/mercurial/dirstatemap.py
@@ -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]