dirstate: deprecate the `merge` method in all cases
authorPierre-Yves David <pierre-yves.david@octobus.net>
Mon, 19 Jul 2021 16:21:22 +0200
changeset 47744 372ff4638cb4
parent 47743 8c73818c67dd
child 47745 06d57a91441e
dirstate: deprecate the `merge` method in all cases All code have been migrated to the new APIs. Differential Revision: https://phab.mercurial-scm.org/D11186
mercurial/dirstate.py
--- a/mercurial/dirstate.py	Sun Jul 18 22:45:18 2021 +0200
+++ b/mercurial/dirstate.py	Mon Jul 19 16:21:22 2021 +0200
@@ -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)