Show More
@@ -47,13 +47,14 from .utils import ( | |||||
47 | if pycompat.TYPE_CHECKING: |
|
47 | if pycompat.TYPE_CHECKING: | |
48 | from typing import ( |
|
48 | from typing import ( | |
49 | Any, |
|
49 | Any, | |
|
50 | Callable, | |||
50 | Dict, |
|
51 | Dict, | |
51 | List, |
|
52 | List, | |
52 | Optional, |
|
53 | Optional, | |
53 | Tuple, |
|
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 | assert t |
|
58 | assert t | |
58 |
|
59 | |||
59 |
|
60 | |||
@@ -721,7 +722,7 def parseopts(ui, pats, opts): | |||||
721 | # type: (Any, List[bytes], Dict[bytes, Any]) -> walkopts |
|
722 | # type: (Any, List[bytes], Dict[bytes, Any]) -> walkopts | |
722 | """Parse log command options into walkopts |
|
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 | if opts.get(b'follow_first'): |
|
727 | if opts.get(b'follow_first'): | |
727 | follow = 1 |
|
728 | follow = 1 | |
@@ -956,11 +957,12 def _initialrevs(repo, wopts): | |||||
956 | return revs |
|
957 | return revs | |
957 |
|
958 | |||
958 |
|
959 | |||
959 |
def |
|
960 | def makewalker(repo, wopts): | |
960 |
# type: (Any, walkopts) -> Tuple[smartset.abstractsmartset, Optional[ |
|
961 | # type: (Any, walkopts) -> Tuple[smartset.abstractsmartset, Optional[Callable[[Any], matchmod.basematcher]]] | |
961 | """Return (revs, differ) where revs is a smartset |
|
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 | revs = _initialrevs(repo, wopts) |
|
967 | revs = _initialrevs(repo, wopts) | |
966 | if not revs: |
|
968 | if not revs: | |
@@ -1003,6 +1005,18 def getrevs(repo, wopts): | |||||
1003 | if wopts.limit is not None: |
|
1005 | if wopts.limit is not None: | |
1004 | revs = revs.slice(0, wopts.limit) |
|
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 | differ = changesetdiffer() |
|
1020 | differ = changesetdiffer() | |
1007 | differ._makefilematcher = filematcher |
|
1021 | differ._makefilematcher = filematcher | |
1008 | return revs, differ |
|
1022 | return revs, differ |
General Comments 0
You need to be logged in to leave comments.
Login now