Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/logcmdutil.py @ 43741:c9301ac73b95
logcmdutil: add a type annotation
This wasn't actually required in the end, as there was a real bug
found by pytype, but the annotation helped me figure that out. We can
drop this patch if that's the preference.
Differential Revision: https://phab.mercurial-scm.org/D7382
author | Augie Fackler <augie@google.com> |
---|---|
date | Wed, 13 Nov 2019 22:22:31 -0500 |
parents | 4093fc1777c2 |
children | 7b14d649af1b |
comparison
equal
deleted
inserted
replaced
43740:a58d2361b231 | 43741:c9301ac73b95 |
---|---|
38 ) | 38 ) |
39 from .utils import ( | 39 from .utils import ( |
40 dateutil, | 40 dateutil, |
41 stringutil, | 41 stringutil, |
42 ) | 42 ) |
43 | |
44 | |
45 if not globals(): | |
46 from typing import ( | |
47 Any, | |
48 Tuple, | |
49 ) | |
50 | |
51 for t in (Any, Tuple): | |
52 assert t | |
43 | 53 |
44 | 54 |
45 def getlimit(opts): | 55 def getlimit(opts): |
46 """get the log limit according to option -l/--limit""" | 56 """get the log limit according to option -l/--limit""" |
47 limit = opts.get(b'limit') | 57 limit = opts.get(b'limit') |
841 revs.reverse() | 851 revs.reverse() |
842 return revs | 852 return revs |
843 | 853 |
844 | 854 |
845 def getrevs(repo, pats, opts): | 855 def getrevs(repo, pats, opts): |
856 # type: (Any, Any, Any) -> Tuple[smartset.BaseSet, changesetdiffer] | |
846 """Return (revs, differ) where revs is a smartset | 857 """Return (revs, differ) where revs is a smartset |
847 | 858 |
848 differ is a changesetdiffer with pre-configured file matcher. | 859 differ is a changesetdiffer with pre-configured file matcher. |
849 """ | 860 """ |
850 follow = opts.get(b'follow') or opts.get(b'follow_first') | 861 follow = opts.get(b'follow') or opts.get(b'follow_first') |