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.
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.
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.
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.
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.
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.
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()`.