Matt Harbison <matt_harbison@yahoo.com> [Wed, 02 Oct 2024 18:30:12 -0400] rev 51947
tests: print the actual timeout value used in `wait-on-file`
Previously, it was printing the time passed in, prior to it being scaled up to
account for a longer timeout.
Matt Harbison <matt_harbison@yahoo.com> [Wed, 02 Oct 2024 18:19:59 -0400] rev 51946
tests: stabilize `test-transaction-wc-rollback-race.t` on Windows
MSYS has a tendency to munge C:\Dir\SubDir\File into C:DirSubDirFile unless it
is quoted, and that's what was happening here- there were a lot of these
failures:
file not created after 5 seconds: $TESTTMP/transaction-waiting
I suspect quoting is only needed in the hook script that is generated (the
catting of the log file pointed me in the right direction here), but I missed a
spot and trial and error got me here. The quoting elsewhere doesn't harm
anything and it was taking 7+ minutes to run this test when things were timing
out, so I don't feel like reducing the quoting to the minimum required.
Matt Harbison <matt_harbison@yahoo.com> [Wed, 02 Oct 2024 16:34:33 -0400] rev 51945
tests: stabilize `test-merge-partial-tool.t` on Windows
The test was previously failing because it was opening the shell scripts being
used as an executable in a text editor, and problems cascaded from there.
Matt Harbison <matt_harbison@yahoo.com> [Wed, 02 Oct 2024 11:43:22 -0400] rev 51944
tests: replace `hg id --debug -i` command substitution with non-debug command
The censor and convert tests were failing on Windows because the `--debug` flag
also prints debug messages, and at least some of these were outputting:
skip updating dirstate: identity mismatch ${node}
Obviously that causes cascading problems. The other tests were OK, but it's
better to use a non debug command for stability.
Matt Harbison <matt_harbison@yahoo.com> [Tue, 01 Oct 2024 21:40:20 -0400] rev 51943
tests: correct Windows output to account for putting repos in `repo` subdir
These were missed in
55c6ebd11cb9, due to being conditionalized and not running
in CI.
Matt Harbison <matt_harbison@yahoo.com> [Tue, 01 Oct 2024 21:34:44 -0400] rev 51942
tests: use pattern matching to mask `ECONNREFUSED` messages
The second and third one of these in `test-http-proxy.t` was failing on Windows.
The others were found by grep and by failed tests when output was matched and an
attempt was made to emit the mask pattern.
The first clonebundles failure on Windows emitted:
error fetching bundle: [WinError 10061] $ECONNREFUSED$
We should probably stringify that better to get rid of the "[WinError 10061]"
part.
Matt Harbison <matt_harbison@yahoo.com> [Sat, 05 Oct 2024 17:32:26 -0400] rev 51941
typing: add stub functions for `cext/charencoding`
I'm not sure if it's better to have a separate file, and currently pytype
doesn't really know how to handle these, so it's no help in figuring that out.
Technically, these methods are part of the `mercurial.cext.parsers` module, so
put them into the existing stub until there's a reason to split it out.
Matt Harbison <matt_harbison@yahoo.com> [Sat, 05 Oct 2024 15:00:37 -0400] rev 51940
interfaces: introduce and use a protocol class for the `charencoding` module
See
f2832de2a46c for details when this was done for the `bdiff` module.
This lets us dump the hack where the `pure` implementation was imported during
the type checking phase to provide signatures for the module methods it
provides. Now the protocol classes are starting to shine, because these methods
are provided by `pure.charencoding` and `cext.parsers`, and references to
`cffi.charencoding` and `cext.charencoding` are forwarded to them as appropriate
by the `policy` module. But none of that matters, as long as the module
returned provides the listed methods.
The interface was copy/pasted from the `pure` module, but `jsonescapeu8fallback`
is omitted because it is accessed from the `pure` module directly when the
escaping fails in the primary module's `jsonescapeu8()`.
Matt Harbison <matt_harbison@yahoo.com> [Fri, 04 Oct 2024 23:23:24 -0400] rev 51939
debugantivirusrunning: use bytes when opening a vfs file
I noticed this when searching for "base85" to see if anything else in the
previous commit needed to be annotated. This was added in
87047efbc6a6, after
the mass byteification in
687b865b95ad.
Matt Harbison <matt_harbison@yahoo.com> [Fri, 04 Oct 2024 23:21:41 -0400] rev 51938
interfaces: introduce and use a protocol class for the `base85` module
See
f2832de2a46c for details when this was done for the `bdiff` module.
It looks like PEP-688 removed the special casing of `bytes` being a standin
for any type of `ByteString`, and defines a `typing.Buffer` class (with a
backport in `typing_extensions` for Python prior to 3.12). There's been a lot
of churn in this area with pytype, but recent versions of pytype and PyCharm
recognize this, and e.g. have `mercurial.node.hex()` defined as:
from typing_extensions import Buffer
def hex(data: Buffer, sep: str | bytes = ..., bytes_per_sep: int = ...) -> bytes
This covers `bytes`, `bytearray`, and `memoryview` by default. Both of the C
functions here use `y#` to parse the arguments, which means the arg is a
byte-like object[2], so the args would appear to be better typed as `Buffer`.
However, pytype has a bug that prevents using this from `typing_extensions`[3],
and mypy complained `Unsupported left operand type for + ("memoryview")` in the
pure module on line 37 (meaning it's only a subset of `Buffer`). So hold off on
changing any of that for now.
[1] https://peps.python.org/pep-0688/#no-special-meaning-for-bytes
[2] https://docs.python.org/3/glossary.html#term-bytes-like-object
[3] https://github.com/google/pytype/issues/1772