Mercurial > hg
comparison hgext/closehead.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 | 9d2b2df2c2ba |
children | 5105a9975407 |
comparison
equal
deleted
inserted
replaced
48115:b067d22dc6ad | 48116:5ced12cfa41b |
---|---|
13 cmdutil, | 13 cmdutil, |
14 context, | 14 context, |
15 error, | 15 error, |
16 pycompat, | 16 pycompat, |
17 registrar, | 17 registrar, |
18 scmutil, | 18 logcmdutil, |
19 ) | 19 ) |
20 | 20 |
21 cmdtable = {} | 21 cmdtable = {} |
22 command = registrar.command(cmdtable) | 22 command = registrar.command(cmdtable) |
23 # Note for extension authors: ONLY specify testedwith = 'ships-with-hg-core' for | 23 # Note for extension authors: ONLY specify testedwith = 'ships-with-hg-core' for |
66 tr.close() | 66 tr.close() |
67 | 67 |
68 opts = pycompat.byteskwargs(opts) | 68 opts = pycompat.byteskwargs(opts) |
69 | 69 |
70 revs += tuple(opts.get(b'rev', [])) | 70 revs += tuple(opts.get(b'rev', [])) |
71 revs = scmutil.revrange(repo, revs) | 71 revs = logcmdutil.revrange(repo, revs) |
72 | 72 |
73 if not revs: | 73 if not revs: |
74 raise error.Abort(_(b'no revisions specified')) | 74 raise error.Abort(_(b'no revisions specified')) |
75 | 75 |
76 heads = [] | 76 heads = [] |