diff --git a/hgext/extdiff.py b/hgext/extdiff.py --- a/hgext/extdiff.py +++ b/hgext/extdiff.py @@ -101,6 +101,7 @@ error, filemerge, formatter, + logcmdutil, pycompat, registrar, scmutil, @@ -568,7 +569,7 @@ ctx1b = repo[nullrev] ctx2 = scmutil.revsingle(repo, to_rev, None) else: - ctx1a, ctx2 = scmutil.revpair(repo, revs) + ctx1a, ctx2 = logcmdutil.revpair(repo, revs) if not revs: ctx1b = repo[None].p2() else: diff --git a/mercurial/commands.py b/mercurial/commands.py --- a/mercurial/commands.py +++ b/mercurial/commands.py @@ -2610,7 +2610,7 @@ ctx2 = scmutil.revsingle(repo, to_rev, None) else: repo = scmutil.unhidehashlikerevs(repo, revs, b'nowarn') - ctx1, ctx2 = scmutil.revpair(repo, revs) + ctx1, ctx2 = logcmdutil.revpair(repo, revs) if reverse: ctxleft = ctx2 @@ -6909,7 +6909,7 @@ ctx1 = ctx2.p1() else: repo = scmutil.unhidehashlikerevs(repo, revs, b'nowarn') - ctx1, ctx2 = scmutil.revpair(repo, revs) + ctx1, ctx2 = logcmdutil.revpair(repo, revs) forcerelativevalue = None if ui.hasconfig(b'commands', b'status.relative'): diff --git a/mercurial/logcmdutil.py b/mercurial/logcmdutil.py --- a/mercurial/logcmdutil.py +++ b/mercurial/logcmdutil.py @@ -912,6 +912,18 @@ return None +def revpair(repo, revs): + """Resolves user-provided revset(s) into two revisions. + + This just wraps the lower-level scmutil.revpair() in order to raise an + exception indicating user error. + """ + try: + return scmutil.revpair(repo, revs) + except error.RepoLookupError as e: + raise error.InputError(e.args[0], hint=e.hint) + + def revrange(repo, specs, localalias=None): """Resolves user-provided revset(s). diff --git a/tests/autodiff.py b/tests/autodiff.py --- a/tests/autodiff.py +++ b/tests/autodiff.py @@ -4,6 +4,7 @@ from mercurial import ( error, + logcmdutil, patch, pycompat, registrar, @@ -49,7 +50,7 @@ else: raise error.Abort(b'--git must be yes, no or auto') - ctx1, ctx2 = scmutil.revpair(repo, []) + ctx1, ctx2 = logcmdutil.revpair(repo, []) m = scmutil.match(ctx2, pats, opts) it = patch.diff( repo,