comparison hgext/largefiles/lfcommands.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 df3021c1f093
comparison
equal deleted inserted replaced
48115:b067d22dc6ad 48116:5ced12cfa41b
24 context, 24 context,
25 error, 25 error,
26 exthelper, 26 exthelper,
27 hg, 27 hg,
28 lock, 28 lock,
29 logcmdutil,
29 match as matchmod, 30 match as matchmod,
30 pycompat, 31 pycompat,
31 scmutil, 32 scmutil,
32 util, 33 util,
33 ) 34 )
655 repo.lfpullsource = source 656 repo.lfpullsource = source
656 657
657 revs = opts.get('rev', []) 658 revs = opts.get('rev', [])
658 if not revs: 659 if not revs:
659 raise error.Abort(_(b'no revisions specified')) 660 raise error.Abort(_(b'no revisions specified'))
660 revs = scmutil.revrange(repo, revs) 661 revs = logcmdutil.revrange(repo, revs)
661 662
662 numcached = 0 663 numcached = 0
663 for rev in revs: 664 for rev in revs:
664 ui.note(_(b'pulling largefiles for revision %d\n') % rev) 665 ui.note(_(b'pulling largefiles for revision %d\n') % rev)
665 (cached, missing) = cachelfiles(ui, repo, rev) 666 (cached, missing) = cachelfiles(ui, repo, rev)