D11184: dirstate: deprecate the `otherparent` method in all cases
marmoute (Pierre-Yves David)
phabricator at mercurial-scm.org
Mon Jul 19 15:07:02 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/D11184
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
@@ -777,7 +777,7 @@
if entry.merged_removed:
self.merge(f)
elif entry.from_p2_removed:
- self.otherparent(f)
+ self._otherparent(f)
if source is not None:
self.copy(source, f)
return
@@ -788,6 +788,23 @@
def otherparent(self, f):
'''Mark as coming from the other parent, always dirty.'''
+ if self.pendingparentchange():
+ util.nouideprecwarn(
+ b"do not use `otherparent` 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 `otherparent` outside of update/merge context."
+ b"It should have been set by the update/merge code",
+ b'6.0',
+ stacklevel=2,
+ )
+ self._otherparent(f)
+
+ def _otherparent(self, f):
if not self.in_merge:
msg = _(b"setting %r to other parent only allowed in merges") % f
raise error.Abort(msg)
@@ -844,7 +861,7 @@
'''Mark a file merged.'''
if not self.in_merge:
return self._normallookup(f)
- return self.otherparent(f)
+ return self._otherparent(f)
def drop(self, f):
'''Drop a file from the dirstate'''
To: marmoute, #hg-reviewers
Cc: mercurial-patches, mercurial-devel
More information about the Mercurial-devel
mailing list