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

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

Comments

phabricator - July 19, 2021, 3:10 p.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/D11186

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
@@ -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)