Mercurial > public > mercurial-scm > hg
diff hgext/mq.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 | 0dc9ced02a3b |
children | 6000f5b25c9b |
line wrap: on
line diff
--- a/hgext/mq.py Tue Sep 28 09:08:43 2021 -0700 +++ b/hgext/mq.py Tue Sep 28 08:47:11 2021 -0700 @@ -1241,7 +1241,7 @@ if opts.get(b'rev'): if not self.applied: raise error.Abort(_(b'no patches applied')) - revs = scmutil.revrange(repo, opts.get(b'rev')) + revs = logcmdutil.revrange(repo, opts.get(b'rev')) revs.sort() revpatches = self._revpatches(repo, revs) realpatches += revpatches @@ -2417,7 +2417,7 @@ raise error.Abort( _(b'option "-r" not valid when importing files') ) - rev = scmutil.revrange(repo, rev) + rev = logcmdutil.revrange(repo, rev) rev.sort(reverse=True) elif not files: raise error.Abort(_(b'no files or revisions specified')) @@ -3878,7 +3878,7 @@ ui.status(_(b'no patches applied\n')) return 0 - revs = scmutil.revrange(repo, revrange) + revs = logcmdutil.revrange(repo, revrange) if repo[b'.'].rev() in revs and repo[None].files(): ui.warn(_(b'warning: uncommitted changes in the working directory\n')) # queue.finish may changes phases but leave the responsibility to lock the