D11133: dirstate: replace `update_parent_file_data` with simpler `update_parent` call

marmoute (Pierre-Yves David) phabricator at mercurial-scm.org
Mon Jul 19 10:41:07 UTC 2021


marmoute created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  This make the dirstate API simpler.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  mercurial/dirstate.py
  mercurial/mergestate.py

CHANGE DETAILS

diff --git a/mercurial/mergestate.py b/mercurial/mergestate.py
--- a/mercurial/mergestate.py
+++ b/mercurial/mergestate.py
@@ -801,7 +801,12 @@
             )
         else:
             parentfiledata = getfiledata[f] if getfiledata else None
-            repo.dirstate.update_parent_file_data(f, parentfiledata)
+            repo.dirstate.update_file(
+                f,
+                p1_tracked=True,
+                wc_tracked=True,
+                parentfiledata=parentfiledata,
+            )
 
     # merge
     for f, args, msg in actions.get(ACTION_MERGE, []):
diff --git a/mercurial/dirstate.py b/mercurial/dirstate.py
--- a/mercurial/dirstate.py
+++ b/mercurial/dirstate.py
@@ -548,6 +548,7 @@
         clean_p1=False,
         clean_p2=False,
         possibly_dirty=False,
+        parentfiledata=None,
     ):
         """update the information about a file in the dirstate
 
@@ -583,19 +584,11 @@
         elif possibly_dirty:
             self._addpath(filename, possibly_dirty=possibly_dirty)
         elif wc_tracked:
-            self.normal(filename)
+            self.normal(filename, parentfiledata=parentfiledata)
         # XXX We need something for file that are dirty after an update
         else:
             assert False, 'unreachable'
 
-    @requires_parents_change
-    def update_parent_file_data(self, f, filedata):
-        """update the information about the content of a file
-
-        This function should be called within a `dirstate.parentchange` context.
-        """
-        self.normal(f, parentfiledata=filedata)
-
     def _addpath(
         self,
         f,



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


More information about the Mercurial-devel mailing list