Patchwork D11161: dirstate: deprecate the `normal` method in all cases

login
register
mail settings
Submitter phabricator
Date July 19, 2021, 10:44 a.m.
Message ID <differential-rev-PHID-DREV-h3rmx4f7btsydbry77mu-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/49474/
State Superseded
Headers show

Comments

phabricator - July 19, 2021, 10:44 a.m.
marmoute created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  All code have been migrated to the new APIs.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  mercurial/dirstate.py

CHANGE DETAILS




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

Patch

diff --git a/mercurial/dirstate.py b/mercurial/dirstate.py
--- a/mercurial/dirstate.py
+++ b/mercurial/dirstate.py
@@ -504,7 +504,7 @@ 
         """record that the current state of the file on disk is known to be clean"""
         self._dirty = True
         self._updatedfiles.add(filename)
-        self.normal(filename, parentfiledata=parentfiledata)
+        self._normal(filename, parentfiledata=parentfiledata)
 
     @requires_parents_change
     def update_file_p1(
@@ -702,6 +702,23 @@ 
         determined the file was clean, to limit the risk of the
         file having been changed by an external process between the
         moment where the file was determined to be clean and now."""
+        if self.pendingparentchange():
+            util.nouideprecwarn(
+                b"do not use `normal` inside of update/merge context."
+                b" Use `update_file` or `update_file_p1`",
+                b'6.0',
+                stacklevel=2,
+            )
+        else:
+            util.nouideprecwarn(
+                b"do not use `normal` outside of update/merge context."
+                b" Use `set_tracked`",
+                b'6.0',
+                stacklevel=2,
+            )
+        self._normal(f, parentfiledata=parentfiledata)
+
+    def _normal(self, f, parentfiledata=None):
         if parentfiledata:
             (mode, size, mtime) = parentfiledata
         else: