diff --git a/hgext/rebase.py b/hgext/rebase.py --- a/hgext/rebase.py +++ b/hgext/rebase.py @@ -20,10 +20,7 @@ import os from mercurial.i18n import _ -from mercurial.node import ( - nullrev, - short, -) +from mercurial.node import nullrev, short from mercurial.pycompat import open from mercurial import ( bookmarks, @@ -627,12 +624,7 @@ 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,33 @@ __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 + + # Temporary hack to minimize test changes: remove in next patch + if opname == b'rebase': + InterventionRequired.__init__( + self, + _( + b"unresolved conflicts (see hg resolve, then hg %s --continue)" + ) + % opname, + ) + else: + 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 @@ -53,10 +53,7 @@ util, vfs as vfsmod, ) -from .utils import ( - dateutil, - stringutil, -) +from .utils import dateutil, stringutil backupdir = b'shelve-backup' shelvedir = b'shelved' @@ -1014,12 +1011,7 @@ 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)