annotate mercurial/cext/parsers.pyi @ 51410:eababb7b4a82

phases: leverage the collected information to record phase update Since the lower level function already gather this information, we can directly use it. This comes with a small change to the test that are actually fixing them. The previous version over-reported some phase change that did not exists. In both case, we are force revision `1` to be secret and `0` remains draft`, the previous code wrongly reported `0` as moving to secret while it properly remained draft in the repository.
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Tue, 20 Feb 2024 23:46:21 +0100
parents f8bf1a8e9181
children e58f02e2f6a9
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
46038
8dca9051a859 cext: add .pyi files for C extensions
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
1 from typing import (
8dca9051a859 cext: add .pyi files for C extensions
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
2 Callable,
8dca9051a859 cext: add .pyi files for C extensions
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
3 Dict,
8dca9051a859 cext: add .pyi files for C extensions
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
4 Iterator,
8dca9051a859 cext: add .pyi files for C extensions
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
5 List,
8dca9051a859 cext: add .pyi files for C extensions
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
6 Optional,
8dca9051a859 cext: add .pyi files for C extensions
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
7 Set,
8dca9051a859 cext: add .pyi files for C extensions
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
8 Tuple,
8dca9051a859 cext: add .pyi files for C extensions
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
9 Union,
8dca9051a859 cext: add .pyi files for C extensions
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
10 )
8dca9051a859 cext: add .pyi files for C extensions
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
11
8dca9051a859 cext: add .pyi files for C extensions
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
12 version: int
8dca9051a859 cext: add .pyi files for C extensions
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
13 versionerrortext: str
8dca9051a859 cext: add .pyi files for C extensions
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
14
47539
84391ddf4c78 dirstate-item: rename the class to DirstateItem
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 47043
diff changeset
15 class DirstateItem:
46038
8dca9051a859 cext: add .pyi files for C extensions
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
16 __doc__: str
8dca9051a859 cext: add .pyi files for C extensions
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
17
8dca9051a859 cext: add .pyi files for C extensions
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
18 def __len__(self) -> int: ...
8dca9051a859 cext: add .pyi files for C extensions
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
19 def __getitem__(self, key: int) -> Union[bytes, int]: ...
8dca9051a859 cext: add .pyi files for C extensions
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
20
8dca9051a859 cext: add .pyi files for C extensions
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
21 # From dirs.c
8dca9051a859 cext: add .pyi files for C extensions
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
22
8dca9051a859 cext: add .pyi files for C extensions
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
23 class dirs:
8dca9051a859 cext: add .pyi files for C extensions
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
24 __doc__: str
8dca9051a859 cext: add .pyi files for C extensions
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
25 def __init__(self, source, skipchar: bytes): ...
8dca9051a859 cext: add .pyi files for C extensions
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
26 def __iter__(self) -> Iterator[bytes]: ...
8dca9051a859 cext: add .pyi files for C extensions
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
27 def addpath(self, path: bytes) -> None: ...
8dca9051a859 cext: add .pyi files for C extensions
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
28 def delpath(self, path: bytes) -> None: ...
8dca9051a859 cext: add .pyi files for C extensions
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
29
8dca9051a859 cext: add .pyi files for C extensions
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
30 # From manifest.c
8dca9051a859 cext: add .pyi files for C extensions
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
31 class lazymanifest:
47043
12450fbea288 manifests: push down expected node length into the parser
Joerg Sonnenberger <joerg@bec.de>
parents: 46038
diff changeset
32 def __init__(self, nodelen: int, data: bytes): ...
46038
8dca9051a859 cext: add .pyi files for C extensions
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
33 def __iter__(self) -> Iterator[bytes]: ...
8dca9051a859 cext: add .pyi files for C extensions
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
34
8dca9051a859 cext: add .pyi files for C extensions
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
35 def __len__(self) -> int: ...
8dca9051a859 cext: add .pyi files for C extensions
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
36 def __getitem__(self, item: bytes) -> Optional[Tuple[bytes, bytes]]: ...
8dca9051a859 cext: add .pyi files for C extensions
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
37 def __setitem__(self, key: bytes, value: Tuple[bytes, bytes]) -> None: ...
8dca9051a859 cext: add .pyi files for C extensions
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
38 def __delitem__(self, key: bytes) -> None: ...
8dca9051a859 cext: add .pyi files for C extensions
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
39
8dca9051a859 cext: add .pyi files for C extensions
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
40 def iterkeys(self) -> Iterator[bytes]: ...
8dca9051a859 cext: add .pyi files for C extensions
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
41 def iterentries(self) -> Iterator[Tuple[bytes, bytes, bytes]]: ...
8dca9051a859 cext: add .pyi files for C extensions
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
42 def copy(self) -> lazymanifest: ...
8dca9051a859 cext: add .pyi files for C extensions
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
43 def filtercopy(self, matchfn: Callable[[bytes], bool]) -> lazymanifest: ...
8dca9051a859 cext: add .pyi files for C extensions
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
44 def diff(self, other: lazymanifest, clean: Optional[bool]) -> Dict[bytes, Tuple[bytes, Tuple]]: ...
8dca9051a859 cext: add .pyi files for C extensions
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
45 def text(self) -> bytes: ...
8dca9051a859 cext: add .pyi files for C extensions
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
46
8dca9051a859 cext: add .pyi files for C extensions
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
47 # From revlog.c
8dca9051a859 cext: add .pyi files for C extensions
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
48
8dca9051a859 cext: add .pyi files for C extensions
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
49 class index:
8dca9051a859 cext: add .pyi files for C extensions
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
50 __doc__: str
8dca9051a859 cext: add .pyi files for C extensions
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
51
8dca9051a859 cext: add .pyi files for C extensions
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
52 nodemap: Dict[bytes, int]
8dca9051a859 cext: add .pyi files for C extensions
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
53
8dca9051a859 cext: add .pyi files for C extensions
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
54 def ancestors(self, *args: int) -> Iterator[int]: ...
8dca9051a859 cext: add .pyi files for C extensions
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
55 def commonancestorsheads(self, *args: int) -> List[int]: ...
8dca9051a859 cext: add .pyi files for C extensions
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
56 def clearcaches(self) -> None: ...
8dca9051a859 cext: add .pyi files for C extensions
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
57 def get(self, value: bytes) -> Optional[int]: ...
8dca9051a859 cext: add .pyi files for C extensions
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
58 def get_rev(self, value: bytes) -> Optional[int]: ...
8dca9051a859 cext: add .pyi files for C extensions
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
59 def has_node(self, value: Union[int, bytes]) -> bool: ...
8dca9051a859 cext: add .pyi files for C extensions
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
60 def rev(self, node: bytes) -> int: ...
51406
f8bf1a8e9181 phases: keep internal state as rev-num instead of node-id
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 49649
diff changeset
61 def computephasesmapsets(self, root: Dict[int, Set[int]]) -> Tuple[int, Dict[int, Set[bytes]]]: ...
46038
8dca9051a859 cext: add .pyi files for C extensions
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
62 def reachableroots2(self, minroot: int, heads: List[int], roots: List[int], includepath: bool) -> List[int]: ...
8dca9051a859 cext: add .pyi files for C extensions
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
63 def headrevs(self, filteredrevs: Optional[List[int]]) -> List[int]: ...
8dca9051a859 cext: add .pyi files for C extensions
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
64 def headrevsfiltered(self, filteredrevs: Optional[List[int]]) -> List[int]: ...
8dca9051a859 cext: add .pyi files for C extensions
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
65 def issnapshot(self, value: int) -> bool: ...
8dca9051a859 cext: add .pyi files for C extensions
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
66 def findsnapshots(self, cache: Dict[int, List[int]], start_rev: int) -> None: ...
8dca9051a859 cext: add .pyi files for C extensions
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
67 def deltachain(self, rev: int, stop: int, generaldelta: bool) -> Tuple[List[int], bool]: ...
8dca9051a859 cext: add .pyi files for C extensions
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
68 def slicechunktodensity(self, revs: List[int], targetdensity: float, mingapsize: int) -> List[List[int]]: ...
8dca9051a859 cext: add .pyi files for C extensions
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
69 def append(self, value: Tuple[int, int, int, int, int, int, int, bytes]) -> None: ...
8dca9051a859 cext: add .pyi files for C extensions
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
70 def partialmatch(self, node: bytes) -> bytes: ...
8dca9051a859 cext: add .pyi files for C extensions
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
71 def shortest(self, value: bytes) -> int: ...
8dca9051a859 cext: add .pyi files for C extensions
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
72 def stats(self) -> Dict[bytes, int]: ...
8dca9051a859 cext: add .pyi files for C extensions
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
73
8dca9051a859 cext: add .pyi files for C extensions
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
74 class nodetree:
8dca9051a859 cext: add .pyi files for C extensions
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
75 __doc__: str
8dca9051a859 cext: add .pyi files for C extensions
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
76
8dca9051a859 cext: add .pyi files for C extensions
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
77 def insert(self, rev: int) -> None: ...
8dca9051a859 cext: add .pyi files for C extensions
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
78 def shortest(self, node: bytes) -> int: ...
49649
df5d3b0d6472 typing: add missing signature for mercurial.cext.parsers.parse_index2()
Matt Harbison <matt_harbison@yahoo.com>
parents: 47539
diff changeset
79
df5d3b0d6472 typing: add missing signature for mercurial.cext.parsers.parse_index2()
Matt Harbison <matt_harbison@yahoo.com>
parents: 47539
diff changeset
80 # The IndexObject type here is defined in C, and there's no type for a buffer
df5d3b0d6472 typing: add missing signature for mercurial.cext.parsers.parse_index2()
Matt Harbison <matt_harbison@yahoo.com>
parents: 47539
diff changeset
81 # return, as of py3.11. https://github.com/python/typing/issues/593
df5d3b0d6472 typing: add missing signature for mercurial.cext.parsers.parse_index2()
Matt Harbison <matt_harbison@yahoo.com>
parents: 47539
diff changeset
82 def parse_index2(data: object, inline: object, format: int = ...) -> Tuple[object, Optional[Tuple[int, object]]]: ...