dirstate: replace `update_parent_file_data` with simpler `update_parent` call
authorPierre-Yves David <pierre-yves.david@octobus.net>
Fri, 16 Jul 2021 22:30:11 +0200
changeset 47691 33beeb32f73a
parent 47690 a685c29ebf54
child 47692 e5fb14a07866
dirstate: replace `update_parent_file_data` with simpler `update_parent` call This make the dirstate API simpler. Differential Revision: https://phab.mercurial-scm.org/D11133
mercurial/dirstate.py
mercurial/mergestate.py
--- a/mercurial/dirstate.py	Fri Jul 16 15:07:16 2021 +0200
+++ b/mercurial/dirstate.py	Fri Jul 16 22:30:11 2021 +0200
@@ -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,
--- a/mercurial/mergestate.py	Fri Jul 16 15:07:16 2021 +0200
+++ b/mercurial/mergestate.py	Fri Jul 16 22:30:11 2021 +0200
@@ -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, []):