# HG changeset patch # User Pierre-Yves David # Date 1626647519 -7200 # Node ID f51aaa0f148537dd81b7bf0594fa7dba02972b47 # Parent 9f19d9f2d191dff69252373698a98ba68343e316 dirstate: deprecate the `otherparent` method in all cases All code have been migrated to the new APIs. Differential Revision: https://phab.mercurial-scm.org/D11184 diff -r 9f19d9f2d191 -r f51aaa0f1485 mercurial/dirstate.py --- a/mercurial/dirstate.py Mon Jul 19 00:26:02 2021 +0200 +++ b/mercurial/dirstate.py Mon Jul 19 00:31:59 2021 +0200 @@ -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'''