Mercurial > public > mercurial-scm > hg
comparison contrib/synthrepo.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 | 89a2afe31e82 |
children | 6000f5b25c9b |
comparison
equal
deleted
inserted
replaced
48115:b067d22dc6ad | 48116:5ced12cfa41b |
---|---|
55 from mercurial import ( | 55 from mercurial import ( |
56 context, | 56 context, |
57 diffutil, | 57 diffutil, |
58 error, | 58 error, |
59 hg, | 59 hg, |
60 logcmdutil, | |
60 patch, | 61 patch, |
61 pycompat, | 62 pycompat, |
62 registrar, | 63 registrar, |
63 scmutil, | |
64 ) | 64 ) |
65 from mercurial.utils import dateutil | 65 from mercurial.utils import dateutil |
66 | 66 |
67 # Note for extension authors: ONLY specify testedwith = 'ships-with-hg-core' for | 67 # Note for extension authors: ONLY specify testedwith = 'ships-with-hg-core' for |
68 # extensions which SHIP WITH MERCURIAL. Non-mainline extensions should | 68 # extensions which SHIP WITH MERCURIAL. Non-mainline extensions should |
178 dirsadded = zerodict() | 178 dirsadded = zerodict() |
179 tzoffset = zerodict() | 179 tzoffset = zerodict() |
180 | 180 |
181 # If a mercurial repo is available, also model the commit history. | 181 # If a mercurial repo is available, also model the commit history. |
182 if repo: | 182 if repo: |
183 revs = scmutil.revrange(repo, revs) | 183 revs = logcmdutil.revrange(repo, revs) |
184 revs.sort() | 184 revs.sort() |
185 | 185 |
186 progress = ui.makeprogress( | 186 progress = ui.makeprogress( |
187 _('analyzing'), unit=_('changesets'), total=len(revs) | 187 _('analyzing'), unit=_('changesets'), total=len(revs) |
188 ) | 188 ) |