Mercurial > public > mercurial-scm > hg-stable
diff hgext/rebase.py @ 48128: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 | 16c60e90a496 |
children | 5105a9975407 |
line wrap: on
line diff
--- a/hgext/rebase.py Tue Sep 28 09:08:43 2021 -0700 +++ b/hgext/rebase.py Tue Sep 28 08:47:11 2021 -0700 @@ -35,6 +35,7 @@ dirstateguard, error, extensions, + logcmdutil, merge as mergemod, mergestate as mergestatemod, mergeutil, @@ -1302,19 +1303,19 @@ dest = None if revf: - rebaseset = scmutil.revrange(repo, revf) + rebaseset = logcmdutil.revrange(repo, revf) if not rebaseset: ui.status(_(b'empty "rev" revision set - nothing to rebase\n')) return None elif srcf: - src = scmutil.revrange(repo, srcf) + src = logcmdutil.revrange(repo, srcf) if not src: ui.status(_(b'empty "source" revision set - nothing to rebase\n')) return None # `+ (%ld)` to work around `wdir()::` being empty rebaseset = repo.revs(b'(%ld):: + (%ld)', src, src) else: - base = scmutil.revrange(repo, basef or [b'.']) + base = logcmdutil.revrange(repo, basef or [b'.']) if not base: ui.status( _(b'empty "base" revision set - ' b"can't compute rebase set\n")