Mercurial > public > mercurial-scm > hg
comparison mercurial/branchmap.py @ 43636:9c1eccdd7ed8
branchmap: annotate constructor type for branchcache
This type signature is...big. But it's correct as far as I can tell,
and it detected a bug.
Differential Revision: https://phab.mercurial-scm.org/D7389
author | Augie Fackler <augie@google.com> |
---|---|
date | Thu, 14 Nov 2019 13:13:36 -0500 |
parents | 43f57b9620d2 |
children | 5cdc3c1292f6 |
comparison
equal
deleted
inserted
replaced
43635:72b454fae92e | 43636:9c1eccdd7ed8 |
---|---|
25 from .utils import ( | 25 from .utils import ( |
26 repoviewutil, | 26 repoviewutil, |
27 stringutil, | 27 stringutil, |
28 ) | 28 ) |
29 | 29 |
30 if not globals(): | |
31 from typing import ( | |
32 Any, | |
33 Callable, | |
34 Dict, | |
35 Iterable, | |
36 List, | |
37 Optional, | |
38 Set, | |
39 Tuple, | |
40 Union, | |
41 ) | |
42 | |
43 assert any( | |
44 (Any, Callable, Dict, Iterable, List, Optional, Set, Tuple, Union,) | |
45 ) | |
46 | |
30 subsettable = repoviewutil.subsettable | 47 subsettable = repoviewutil.subsettable |
31 | 48 |
32 calcsize = struct.calcsize | 49 calcsize = struct.calcsize |
33 pack_into = struct.pack_into | 50 pack_into = struct.pack_into |
34 unpack_from = struct.unpack_from | 51 unpack_from = struct.unpack_from |
163 tiprev=nullrev, | 180 tiprev=nullrev, |
164 filteredhash=None, | 181 filteredhash=None, |
165 closednodes=None, | 182 closednodes=None, |
166 hasnode=None, | 183 hasnode=None, |
167 ): | 184 ): |
185 # type: (Union[Dict[bytes, List[bytes]], Iterable[Tuple[bytes, List[bytes]]]], bytes, int, Optional[bytes], Optional[Set[bytes]], Optional[Callable[[bytes], bool]]) -> None | |
168 """ hasnode is a function which can be used to verify whether changelog | 186 """ hasnode is a function which can be used to verify whether changelog |
169 has a given node or not. If it's not provided, we assume that every node | 187 has a given node or not. If it's not provided, we assume that every node |
170 we have exists in changelog """ | 188 we have exists in changelog """ |
171 self.tipnode = tipnode | 189 self.tipnode = tipnode |
172 self.tiprev = tiprev | 190 self.tiprev = tiprev |
175 # cache has been updated, it may contain nodes that are no longer | 193 # cache has been updated, it may contain nodes that are no longer |
176 # heads. | 194 # heads. |
177 if closednodes is None: | 195 if closednodes is None: |
178 self._closednodes = set() | 196 self._closednodes = set() |
179 else: | 197 else: |
180 self._closednodes = set(closednodes) | 198 self._closednodes = closednodes |
181 self._entries = dict(entries) | 199 self._entries = dict(entries) |
182 # whether closed nodes are verified or not | 200 # whether closed nodes are verified or not |
183 self._closedverified = False | 201 self._closedverified = False |
184 # branches for which nodes are verified | 202 # branches for which nodes are verified |
185 self._verifiedbranches = set() | 203 self._verifiedbranches = set() |