# HG changeset patch # User Daniel Ploch # Date 2020-07-14 20:35:54 # Node ID e429e7c801b2a90e3eb48eee0042f0a4c93b058d # Parent dc5e5577af3945ee80a2734b3ab0c7a4b9055f57 error: normalize "unresolved conflicts" error messages with a custom class Differential Revision: https://phab.mercurial-scm.org/D8713 diff --git a/hgext/rebase.py b/hgext/rebase.py --- a/hgext/rebase.py +++ b/hgext/rebase.py @@ -630,12 +630,7 @@ class rebaseruntime(object): if self.inmemory: raise error.InMemoryMergeConflictsError() else: - raise error.InterventionRequired( - _( - b"unresolved conflicts (see 'hg " - b"resolve', then 'hg rebase --continue')" - ) - ) + raise error.ConflictResolutionRequired(b'rebase') if not self.collapsef: merging = p2 != nullrev editform = cmdutil.mergeeditform(merging, b'rebase') diff --git a/mercurial/error.py b/mercurial/error.py --- a/mercurial/error.py +++ b/mercurial/error.py @@ -106,6 +106,22 @@ class InterventionRequired(Hint, Excepti __bytes__ = _tobytes +class ConflictResolutionRequired(InterventionRequired): + """Exception raised when a continuable command required merge conflict resolution.""" + + def __init__(self, opname): + from .i18n import _ + + self.opname = opname + InterventionRequired.__init__( + self, + _( + b"unresolved conflicts (see 'hg resolve', then 'hg %s --continue')" + ) + % opname, + ) + + class Abort(Hint, Exception): """Raised if a command needs to print an error and exit.""" diff --git a/mercurial/shelve.py b/mercurial/shelve.py --- a/mercurial/shelve.py +++ b/mercurial/shelve.py @@ -1014,12 +1014,7 @@ def _rebaserestoredcommit( activebookmark, interactive, ) - raise error.InterventionRequired( - _( - b"unresolved conflicts (see 'hg resolve', then " - b"'hg unshelve --continue')" - ) - ) + raise error.ConflictResolutionRequired(b'unshelve') with repo.dirstate.parentchange(): repo.setparents(tmpwctx.node(), nodemod.nullid)