annotate mercurial/cext/parsers.pyi @ 52188:e4b242f9d4d9 stable tip

streamclone: disable the volatile file open handle optimization on Windows Leaving files open caused new failures like this, since a47f09da8bd1: diff --git a/tests/test-persistent-nodemap-stream-clone.t b/tests/test-persistent-nodemap-stream-clone.t --- a/tests/test-persistent-nodemap-stream-clone.t +++ b/tests/test-persistent-nodemap-stream-clone.t @@ -115,7 +115,12 @@ Do a mix of clone and commit at the same $ (hg clone -U --stream ssh://user@dummy/test-repo stream-clone-race-1 --debug 2>> clone-output | grep -E '00(changelog|manifest)' >> clone-output; touch $HG_TEST_STREAM_WALKED_FILE_3) & $ $RUNTESTDIR/testlib/wait-on-file 10 $HG_TEST_STREAM_WALKED_FILE_1 $ hg -R test-repo/ commit -m foo - created new head + transaction abort! + failed to recover 00changelog.n ([WinError 32] The process cannot access the file because it is being used by another process: b'$STR_REPR_TESTTMP\\test-repo/.hg/store/00changelog.n' -> b'$STR_REPR_TESTTMP\\test-repo/.hg/store/00changelog.n-f418dcd6') + rollback failed - please run hg recover + (failure reason: [WinError 32] The process cannot access the file because it is being used by another process: b'$STR_REPR_TESTTMP\\test-repo/.hg/store/00changelog.n' -> b'$STR_REPR_TESTTMP\\test-repo/.hg/store/00changelog.n-f418dcd6') + abort: The process cannot access the file because it is being used by another process: '$TESTTMP\test-repo\.hg\store\00changelog.n' + [255] $ touch $HG_TEST_STREAM_WALKED_FILE_2 $ $RUNTESTDIR/testlib/wait-on-file 10 $HG_TEST_STREAM_WALKED_FILE_3 $ cat clone-output Since the `VolatileManager` falls back to the old copy method when the open file threshold is exceeded, this just drops the threshold so that only 1 file is open. The actual value used (2) is unexpected, and explained inline. I'd like to have a config option for this so that we can test both ways (in theory, it could resort to copies on non-Windows systems too), but I don't see a `uimod.ui` handy. Alternately, I tried replacing the 3 `open()` calls in the `VolatileManager` with `util.posixfile()`, but that simply hung the test on Windows for some reason, I think on the same line that's indicated as failing above. (There was a `grep` command hanging around, as well as `hg -R test-repo serve --stdio`.)
author Matt Harbison <matt_harbison@yahoo.com>
date Mon, 04 Nov 2024 16:43:05 -0500
parents 8060257fd918
children
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
51941
e58f02e2f6a9 typing: add stub functions for `cext/charencoding`
Matt Harbison <matt_harbison@yahoo.com>
parents: 51406
diff changeset
15 # From charencode.c
e58f02e2f6a9 typing: add stub functions for `cext/charencoding`
Matt Harbison <matt_harbison@yahoo.com>
parents: 51406
diff changeset
16
e58f02e2f6a9 typing: add stub functions for `cext/charencoding`
Matt Harbison <matt_harbison@yahoo.com>
parents: 51406
diff changeset
17 # Note: the first 'bytes' arg of isasciistr() can be typed as 'Buffer' from the
e58f02e2f6a9 typing: add stub functions for `cext/charencoding`
Matt Harbison <matt_harbison@yahoo.com>
parents: 51406
diff changeset
18 # typing_extensions backport, once the related bug is fixed in pytype, or pytype
e58f02e2f6a9 typing: add stub functions for `cext/charencoding`
Matt Harbison <matt_harbison@yahoo.com>
parents: 51406
diff changeset
19 # is run under py3.12. The arg for asciilower(), asciiupper() and
e58f02e2f6a9 typing: add stub functions for `cext/charencoding`
Matt Harbison <matt_harbison@yahoo.com>
parents: 51406
diff changeset
20 # jsonescapeu8fast() is checked specifically for the 'bytes' type. The 'bytes'
e58f02e2f6a9 typing: add stub functions for `cext/charencoding`
Matt Harbison <matt_harbison@yahoo.com>
parents: 51406
diff changeset
21 # return is an instance of 'bytes', not an alias for 'Buffer'.
e58f02e2f6a9 typing: add stub functions for `cext/charencoding`
Matt Harbison <matt_harbison@yahoo.com>
parents: 51406
diff changeset
22 #
e58f02e2f6a9 typing: add stub functions for `cext/charencoding`
Matt Harbison <matt_harbison@yahoo.com>
parents: 51406
diff changeset
23 # https://github.com/google/pytype/issues/1772
e58f02e2f6a9 typing: add stub functions for `cext/charencoding`
Matt Harbison <matt_harbison@yahoo.com>
parents: 51406
diff changeset
24 def isasciistr(s: bytes) -> bool: ...
e58f02e2f6a9 typing: add stub functions for `cext/charencoding`
Matt Harbison <matt_harbison@yahoo.com>
parents: 51406
diff changeset
25 def asciilower(s: bytes) -> bytes: ...
e58f02e2f6a9 typing: add stub functions for `cext/charencoding`
Matt Harbison <matt_harbison@yahoo.com>
parents: 51406
diff changeset
26 def asciiupper(s: bytes) -> bytes: ...
e58f02e2f6a9 typing: add stub functions for `cext/charencoding`
Matt Harbison <matt_harbison@yahoo.com>
parents: 51406
diff changeset
27 def jsonescapeu8fast(u8chars: bytes, paranoid: bool) -> bytes: ...
e58f02e2f6a9 typing: add stub functions for `cext/charencoding`
Matt Harbison <matt_harbison@yahoo.com>
parents: 51406
diff changeset
28
e58f02e2f6a9 typing: add stub functions for `cext/charencoding`
Matt Harbison <matt_harbison@yahoo.com>
parents: 51406
diff changeset
29
47539
84391ddf4c78 dirstate-item: rename the class to DirstateItem
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 47043
diff changeset
30 class DirstateItem:
46038
8dca9051a859 cext: add .pyi files for C extensions
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
31 __doc__: str
8dca9051a859 cext: add .pyi files for C extensions
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
32
8dca9051a859 cext: add .pyi files for C extensions
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
33 def __len__(self) -> int: ...
8dca9051a859 cext: add .pyi files for C extensions
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
34 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
35
8dca9051a859 cext: add .pyi files for C extensions
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
36 # From dirs.c
8dca9051a859 cext: add .pyi files for C extensions
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
37
8dca9051a859 cext: add .pyi files for C extensions
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
38 class dirs:
8dca9051a859 cext: add .pyi files for C extensions
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
39 __doc__: str
8dca9051a859 cext: add .pyi files for C extensions
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
40 def __init__(self, source, skipchar: bytes): ...
8dca9051a859 cext: add .pyi files for C extensions
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
41 def __iter__(self) -> Iterator[bytes]: ...
8dca9051a859 cext: add .pyi files for C extensions
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
42 def addpath(self, path: bytes) -> None: ...
8dca9051a859 cext: add .pyi files for C extensions
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
43 def delpath(self, path: bytes) -> None: ...
8dca9051a859 cext: add .pyi files for C extensions
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
44
8dca9051a859 cext: add .pyi files for C extensions
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
45 # From manifest.c
8dca9051a859 cext: add .pyi files for C extensions
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
46 class lazymanifest:
47043
12450fbea288 manifests: push down expected node length into the parser
Joerg Sonnenberger <joerg@bec.de>
parents: 46038
diff changeset
47 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
48 def __iter__(self) -> Iterator[bytes]: ...
8dca9051a859 cext: add .pyi files for C extensions
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
49
8dca9051a859 cext: add .pyi files for C extensions
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
50 def __len__(self) -> int: ...
8dca9051a859 cext: add .pyi files for C extensions
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
51 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
52 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
53 def __delitem__(self, key: bytes) -> None: ...
8dca9051a859 cext: add .pyi files for C extensions
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
54
8dca9051a859 cext: add .pyi files for C extensions
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
55 def iterkeys(self) -> Iterator[bytes]: ...
8dca9051a859 cext: add .pyi files for C extensions
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
56 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
57 def copy(self) -> lazymanifest: ...
8dca9051a859 cext: add .pyi files for C extensions
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
58 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
59 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
60 def text(self) -> bytes: ...
8dca9051a859 cext: add .pyi files for C extensions
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
61
8dca9051a859 cext: add .pyi files for C extensions
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
62 # From revlog.c
8dca9051a859 cext: add .pyi files for C extensions
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
63
8dca9051a859 cext: add .pyi files for C extensions
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
64 class index:
8dca9051a859 cext: add .pyi files for C extensions
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
65 __doc__: str
8dca9051a859 cext: add .pyi files for C extensions
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
66
8dca9051a859 cext: add .pyi files for C extensions
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
67 nodemap: Dict[bytes, int]
8dca9051a859 cext: add .pyi files for C extensions
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
68
8dca9051a859 cext: add .pyi files for C extensions
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
69 def ancestors(self, *args: int) -> Iterator[int]: ...
8dca9051a859 cext: add .pyi files for C extensions
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
70 def commonancestorsheads(self, *args: int) -> List[int]: ...
8dca9051a859 cext: add .pyi files for C extensions
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
71 def clearcaches(self) -> None: ...
8dca9051a859 cext: add .pyi files for C extensions
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
72 def get(self, value: bytes) -> Optional[int]: ...
8dca9051a859 cext: add .pyi files for C extensions
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
73 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
74 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
75 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
76 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
77 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
78 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
79 def issnapshot(self, value: int) -> bool: ...
8dca9051a859 cext: add .pyi files for C extensions
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
80 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
81 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
82 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
83 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
84 def partialmatch(self, node: bytes) -> bytes: ...
8dca9051a859 cext: add .pyi files for C extensions
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
85 def shortest(self, value: bytes) -> int: ...
8dca9051a859 cext: add .pyi files for C extensions
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
86 def stats(self) -> Dict[bytes, int]: ...
8dca9051a859 cext: add .pyi files for C extensions
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
87
8dca9051a859 cext: add .pyi files for C extensions
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
88 class nodetree:
8dca9051a859 cext: add .pyi files for C extensions
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
89 __doc__: str
8dca9051a859 cext: add .pyi files for C extensions
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
90
8dca9051a859 cext: add .pyi files for C extensions
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
91 def insert(self, rev: int) -> None: ...
8dca9051a859 cext: add .pyi files for C extensions
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
92 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
93
df5d3b0d6472 typing: add missing signature for mercurial.cext.parsers.parse_index2()
Matt Harbison <matt_harbison@yahoo.com>
parents: 47539
diff changeset
94 # 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
95 # 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
96 def parse_index2(data: object, inline: object, format: int = ...) -> Tuple[object, Optional[Tuple[int, object]]]: ...