Mercurial > public > mercurial-scm > hg
diff hgext/histedit.py @ 48116:5ced12cfa41b
errors: raise InputError on bad revset to revrange() iff provided by the user
Most callers of `scmutil.revrange()` pass in a revset provided by the
user. If there are problems resolving that, it should result in an
`InputError` and exit code 10 (when using detailed exit
codes). However, there are also some callers that pass in revsets not
provided by the user. `InputError` is not appropriate in those
cases. This patch therefore introduces a wrapper around
`scmutil.revrange()` that simply converts the exception type. I put it
in `logcmdutil.py` since that seems to be the lowest-level module in
the (poorly defined) UI layer.
Differential Revision: https://phab.mercurial-scm.org/D11560
author | Martin von Zweigbergk <martinvonz@google.com> |
---|---|
date | Tue, 28 Sep 2021 08:47:11 -0700 |
parents | f27a83399abb |
children | b6fc7d188f68 |
line wrap: on
line diff
--- a/hgext/histedit.py Tue Sep 28 09:08:43 2021 -0700 +++ b/hgext/histedit.py Tue Sep 28 08:47:11 2021 -0700 @@ -1707,7 +1707,7 @@ _(b'histedit requires exactly one ancestor revision') ) - rr = list(repo.set(b'roots(%ld)', scmutil.revrange(repo, revs))) + rr = list(repo.set(b'roots(%ld)', logcmdutil.revrange(repo, revs))) if len(rr) != 1: raise error.InputError( _( @@ -1982,7 +1982,7 @@ hastags = False if revs: - revs = scmutil.revrange(repo, revs) + revs = logcmdutil.revrange(repo, revs) ctxs = [repo[rev] for rev in revs] for ctx in ctxs: tags = [tag for tag in ctx.tags() if tag != b'tip'] @@ -2205,7 +2205,7 @@ remote = None root = findoutgoing(ui, repo, remote, force, opts) else: - rr = list(repo.set(b'roots(%ld)', scmutil.revrange(repo, revs))) + rr = list(repo.set(b'roots(%ld)', logcmdutil.revrange(repo, revs))) if len(rr) != 1: raise error.InputError( _(