Mercurial > hg
comparison hgext/largefiles/overrides.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 | 82e142b9ad18 |
children | 5105a9975407 |
comparison
equal
deleted
inserted
replaced
48115:b067d22dc6ad | 48116:5ced12cfa41b |
---|---|
998 lfrevs.append(b'pulled()') | 998 lfrevs.append(b'pulled()') |
999 if lfrevs and revspostpull > revsprepull: | 999 if lfrevs and revspostpull > revsprepull: |
1000 numcached = 0 | 1000 numcached = 0 |
1001 repo.firstpulled = revsprepull # for pulled() revset expression | 1001 repo.firstpulled = revsprepull # for pulled() revset expression |
1002 try: | 1002 try: |
1003 for rev in scmutil.revrange(repo, lfrevs): | 1003 for rev in logcmdutil.revrange(repo, lfrevs): |
1004 ui.note(_(b'pulling largefiles for revision %d\n') % rev) | 1004 ui.note(_(b'pulling largefiles for revision %d\n') % rev) |
1005 (cached, missing) = lfcommands.cachelfiles(ui, repo, rev) | 1005 (cached, missing) = lfcommands.cachelfiles(ui, repo, rev) |
1006 numcached += len(cached) | 1006 numcached += len(cached) |
1007 finally: | 1007 finally: |
1008 del repo.firstpulled | 1008 del repo.firstpulled |
1025 def overridepush(orig, ui, repo, *args, **kwargs): | 1025 def overridepush(orig, ui, repo, *args, **kwargs): |
1026 """Override push command and store --lfrev parameters in opargs""" | 1026 """Override push command and store --lfrev parameters in opargs""" |
1027 lfrevs = kwargs.pop('lfrev', None) | 1027 lfrevs = kwargs.pop('lfrev', None) |
1028 if lfrevs: | 1028 if lfrevs: |
1029 opargs = kwargs.setdefault('opargs', {}) | 1029 opargs = kwargs.setdefault('opargs', {}) |
1030 opargs[b'lfrevs'] = scmutil.revrange(repo, lfrevs) | 1030 opargs[b'lfrevs'] = logcmdutil.revrange(repo, lfrevs) |
1031 return orig(ui, repo, *args, **kwargs) | 1031 return orig(ui, repo, *args, **kwargs) |
1032 | 1032 |
1033 | 1033 |
1034 @eh.wrapfunction(exchange, b'pushoperation') | 1034 @eh.wrapfunction(exchange, b'pushoperation') |
1035 def exchangepushoperation(orig, *args, **kwargs): | 1035 def exchangepushoperation(orig, *args, **kwargs): |