Mercurial > hg
comparison hgext/patchbomb.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 | ff2304dd3ba9 |
children | 6000f5b25c9b |
comparison
equal
deleted
inserted
replaced
48115:b067d22dc6ad | 48116:5ced12cfa41b |
---|---|
89 commands, | 89 commands, |
90 encoding, | 90 encoding, |
91 error, | 91 error, |
92 formatter, | 92 formatter, |
93 hg, | 93 hg, |
94 logcmdutil, | |
94 mail, | 95 mail, |
95 patch, | 96 patch, |
96 pycompat, | 97 pycompat, |
97 registrar, | 98 registrar, |
98 scmutil, | 99 scmutil, |
810 elif bookmark: | 811 elif bookmark: |
811 if bookmark not in repo._bookmarks: | 812 if bookmark not in repo._bookmarks: |
812 raise error.Abort(_(b"bookmark '%s' not found") % bookmark) | 813 raise error.Abort(_(b"bookmark '%s' not found") % bookmark) |
813 revs = scmutil.bookmarkrevs(repo, bookmark) | 814 revs = scmutil.bookmarkrevs(repo, bookmark) |
814 | 815 |
815 revs = scmutil.revrange(repo, revs) | 816 revs = logcmdutil.revrange(repo, revs) |
816 if outgoing: | 817 if outgoing: |
817 revs = _getoutgoing(repo, dest, revs) | 818 revs = _getoutgoing(repo, dest, revs) |
818 if bundle: | 819 if bundle: |
819 opts[b'revs'] = [b"%d" % r for r in revs] | 820 opts[b'revs'] = [b"%d" % r for r in revs] |
820 | 821 |