[Updated] D11561: errors: raise InputError from revpair() iff revset provided by the user
martinvonz (Martin von Zweigbergk)
phabricator at mercurial-scm.org
Fri Oct 1 21:15:33 UTC 2021
Closed by commit rHGb74e128676d4: errors: raise InputError from revpair() iff revset provided by the user (authored by martinvonz).
This revision was automatically updated to reflect the committed changes.
REPOSITORY
rHG Mercurial
CHANGES SINCE LAST UPDATE
https://phab.mercurial-scm.org/D11561?vs=30518&id=30547
CHANGES SINCE LAST ACTION
https://phab.mercurial-scm.org/D11561/new/
REVISION DETAIL
https://phab.mercurial-scm.org/D11561
AFFECTED FILES
hgext/extdiff.py
mercurial/commands.py
mercurial/logcmdutil.py
tests/autodiff.py
CHANGE DETAILS
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,
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/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/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:
To: martinvonz, #hg-reviewers, Alphare
Cc: mercurial-patches
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mercurial-scm.org/pipermail/mercurial-patches/attachments/20211001/3a4e4e49/attachment-0002.html>
More information about the Mercurial-patches
mailing list