Show More
@@ -47,13 +47,14 from .utils import ( | |||
|
47 | 47 | if pycompat.TYPE_CHECKING: |
|
48 | 48 | from typing import ( |
|
49 | 49 | Any, |
|
50 | Callable, | |
|
50 | 51 | Dict, |
|
51 | 52 | List, |
|
52 | 53 | Optional, |
|
53 | 54 | Tuple, |
|
54 | 55 | ) |
|
55 | 56 | |
|
56 | for t in (Any, Dict, List, Optional, Tuple): | |
|
57 | for t in (Any, Callable, Dict, List, Optional, Tuple): | |
|
57 | 58 | assert t |
|
58 | 59 | |
|
59 | 60 | |
@@ -721,7 +722,7 def parseopts(ui, pats, opts): | |||
|
721 | 722 | # type: (Any, List[bytes], Dict[bytes, Any]) -> walkopts |
|
722 | 723 | """Parse log command options into walkopts |
|
723 | 724 | |
|
724 | The returned walkopts will be passed in to getrevs(). | |
|
725 | The returned walkopts will be passed in to getrevs() or makewalker(). | |
|
725 | 726 | """ |
|
726 | 727 | if opts.get(b'follow_first'): |
|
727 | 728 | follow = 1 |
@@ -956,11 +957,12 def _initialrevs(repo, wopts): | |||
|
956 | 957 | return revs |
|
957 | 958 | |
|
958 | 959 | |
|
959 |
def |
|
|
960 |
# type: (Any, walkopts) -> Tuple[smartset.abstractsmartset, Optional[ |
|
|
961 | """Return (revs, differ) where revs is a smartset | |
|
960 | def makewalker(repo, wopts): | |
|
961 | # type: (Any, walkopts) -> Tuple[smartset.abstractsmartset, Optional[Callable[[Any], matchmod.basematcher]]] | |
|
962 | """Build (revs, makefilematcher) to scan revision/file history | |
|
962 | 963 | |
|
963 | differ is a changesetdiffer with pre-configured file matcher. | |
|
964 | - revs is the smartset to be traversed. | |
|
965 | - makefilematcher is a function to map ctx to a matcher for that revision | |
|
964 | 966 | """ |
|
965 | 967 | revs = _initialrevs(repo, wopts) |
|
966 | 968 | if not revs: |
@@ -1003,6 +1005,18 def getrevs(repo, wopts): | |||
|
1003 | 1005 | if wopts.limit is not None: |
|
1004 | 1006 | revs = revs.slice(0, wopts.limit) |
|
1005 | 1007 | |
|
1008 | return revs, filematcher | |
|
1009 | ||
|
1010 | ||
|
1011 | def getrevs(repo, wopts): | |
|
1012 | # type: (Any, walkopts) -> Tuple[smartset.abstractsmartset, Optional[changesetdiffer]] | |
|
1013 | """Return (revs, differ) where revs is a smartset | |
|
1014 | ||
|
1015 | differ is a changesetdiffer with pre-configured file matcher. | |
|
1016 | """ | |
|
1017 | revs, filematcher = makewalker(repo, wopts) | |
|
1018 | if not revs: | |
|
1019 | return revs, None | |
|
1006 | 1020 | differ = changesetdiffer() |
|
1007 | 1021 | differ._makefilematcher = filematcher |
|
1008 | 1022 | return revs, differ |
General Comments 0
You need to be logged in to leave comments.
Login now