Matt Harbison <matt_harbison@yahoo.com> [Tue, 08 Nov 2022 14:31:10 -0500] rev 49600
typing: fix the typehint for `skip` arg on `osutil.listdir()` to be optional
The cffi and pure implementations both default to `None`, and the args are
parsed in C with `"y#|OO:listdir"`, with the C variable initialized to NULL.
Matt Harbison <matt_harbison@yahoo.com> [Tue, 08 Nov 2022 14:17:56 -0500] rev 49599
typing: add type hints to mpatch implementations
Again, using `merge-pyi` to apply the stubs in cext and then manually type the
private methods. The generated stub without these hints inferred very little,
and the stuff it did was wrong.
Matt Harbison <matt_harbison@yahoo.com> [Tue, 08 Nov 2022 13:59:16 -0500] rev 49598
typing: add type hints to bdiff implementations
Not super important code, but this was an exercise in using `merge-pyi` to fold
type stubs back into the code on something small. The cext stubs don't seem to
be getting used (at least the only thing in `.pytype/pyi/mercurial/cext` after a
run generating the stubs is `__init__.pyi`), so maybe this will help some.
Matt Harbison <matt_harbison@yahoo.com> [Tue, 08 Nov 2022 13:52:46 -0500] rev 49597
cffi: adjust the list returned by bdiff.blocks to never have a None entry
This was flagged by pytype after merging the corresponding bdiff.pyi in cext:
File ".../mercurial/cffi/bdiff.py", line 44, in blocks: bad return type [bad-return-type]
Expected: List[Tuple[int, int, int, int]]
Actually returned: List[None]
AFAICT, all callers immediately unpack the tuple into 4 variables, so a `None`
entry would simply crash if they aren't all overwritten. As long a `count` and
the link list are consistent, this shouldn't be a problem.
This placates both pytype and PyCharm (which complained about the `i` in `rl[i]`
having the wrong type with the old code).
Matt Harbison <matt_harbison@yahoo.com> [Tue, 08 Nov 2022 13:38:06 -0500] rev 49596
typing: fix a syntax error in mercurial/cext/bdiff.pyi
I noticed because `merge-pyi` on the non-cext implementations with this file as
input skipped the return type for this. `pytype-single --parse-pyi` confirmed
it was a problem.
Raphaël Gomès <rgomes@octobus.net> [Mon, 14 Nov 2022 13:35:56 +0100] rev 49595
hg-core: relax dependencies pinning
Being this rigid makes packagers' job more difficult since they might not
carry the exact version. This hard pinning was introduced in
eb02decdf but
wasn't strictly necessary to achieve its compatibility goal.
Anton Shestakov <av6@dwimlabs.net> [Mon, 14 Nov 2022 19:58:44 +0400] rev 49594
tests: make running ls in a no longer existing directory more portable
On Linux, ls -A simply returns nothing and the exit code is 0.
On NetBSD, ls -A complains that . doesn't exist and the exit code is 1.
Sadly, it's not possible to do something like "[1] (?)", so " || true" is the
best I could come up with.