D11186: dirstate: deprecate the `merge` method in all cases

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


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/D11186

AFFECTED FILES
  mercurial/dirstate.py

CHANGE DETAILS

diff --git a/mercurial/dirstate.py b/mercurial/dirstate.py
--- a/mercurial/dirstate.py
+++ b/mercurial/dirstate.py
@@ -775,7 +775,7 @@
                 if entry.merged_removed or entry.from_p2_removed:
                     source = self._map.copymap.get(f)
                     if entry.merged_removed:
-                        self.merge(f)
+                        self._merge(f)
                     elif entry.from_p2_removed:
                         self._otherparent(f)
                     if source is not None:
@@ -859,6 +859,23 @@
 
     def merge(self, f):
         '''Mark a file merged.'''
+        if self.pendingparentchange():
+            util.nouideprecwarn(
+                b"do not use `merge` inside of update/merge context."
+                b" Use `update_file`",
+                b'6.0',
+                stacklevel=2,
+            )
+        else:
+            util.nouideprecwarn(
+                b"do not use `merge` outside of update/merge context."
+                b"It should have been set by the update/merge code",
+                b'6.0',
+                stacklevel=2,
+            )
+        self._merge(f)
+
+    def _merge(self, f):
         if not self.in_merge:
             return self._normallookup(f)
         return self._otherparent(f)



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


More information about the Mercurial-devel mailing list