|
@@ -24,7 +24,7 @@
|
|
|
import collections
|
|
|
import heapq
|
|
|
from itertools import chain
|
|
|
-from typing import List, Tuple, Set
|
|
|
+from typing import List, Tuple, Set, Deque, Literal, Optional
|
|
|
|
|
|
from dulwich.diff_tree import (
|
|
|
RENAME_CHANGE_TYPES,
|
|
@@ -242,16 +242,16 @@ class Walker(object):
|
|
|
def __init__(
|
|
|
self,
|
|
|
store,
|
|
|
- include,
|
|
|
- exclude=None,
|
|
|
- order=ORDER_DATE,
|
|
|
- reverse=False,
|
|
|
- max_entries=None,
|
|
|
- paths=None,
|
|
|
- rename_detector=None,
|
|
|
- follow=False,
|
|
|
- since=None,
|
|
|
- until=None,
|
|
|
+ include: List[bytes],
|
|
|
+ exclude: Optional[List[bytes]] = None,
|
|
|
+ order: Literal["date", "topo"] = 'date',
|
|
|
+ reverse: bool = False,
|
|
|
+ max_entries: Optional[int] = None,
|
|
|
+ paths: Optional[List[bytes]] = None,
|
|
|
+ rename_detector: Optional[RenameDetector] = None,
|
|
|
+ follow: bool = False,
|
|
|
+ since: Optional[int] = None,
|
|
|
+ until: Optional[int] = None,
|
|
|
get_parents=lambda commit: commit.parents,
|
|
|
queue_cls=_CommitTimeQueue,
|
|
|
):
|
|
@@ -306,11 +306,13 @@ class Walker(object):
|
|
|
|
|
|
self._num_entries = 0
|
|
|
self._queue = queue_cls(self)
|
|
|
- self._out_queue = collections.deque()
|
|
|
+ self._out_queue: Deque[WalkEntry] = collections.deque()
|
|
|
|
|
|
def _path_matches(self, changed_path):
|
|
|
if changed_path is None:
|
|
|
return False
|
|
|
+ if self.paths is None:
|
|
|
+ return True
|
|
|
for followed_path in self.paths:
|
|
|
if changed_path == followed_path:
|
|
|
return True
|