typing: add some type hints for bundle2 capabilities
Somewhere between hg
3dbc7b1ecaba and hg
8e3f6b5bf720, pytype determined the
signature of `bundle20.capabilities` changed from `Dict[bytes, Tuple[bytes]]` to
`Dict[bytes, Union[List[bytes], Tuple[bytes]]]`.
First, I did try to simply be explicit about the previously inferred type, but
it does seem to mix and match list/tuple now (e.g. in `writenewbundle()`). I
tried changing the new list usage to tuple, but a couple of things complained,
(and I think lists of one item are a little more clear to read anyway). So then
I typed the dict value as `Sequence[bytes]`, which worked fine. But there's
also a module level `capabilities` field, and when that's typed, pytype
complains about `Sequence[bytes]` lacking `__add__`[1]. So I gave up, and just
assigned it the type it wanted, with an alias. If somebody feels motivated to
make the type consistent, it's simple enough to change the alias.
The mutable default value to the constructor was removed to appease PyCharm's
type checking on the field. (I didn't bother running the code through pytype
prior to changing it, because we've previously made an effort to remove this
pattern anyway.)
I'm not sure why `getrepocaps()` has a default value for `role` that apparently
raises an exception. It's just flagged for now so this series can land without
risking additional problems.
[1] https://foss.heptapod.net/mercurial/mercurial-devel/-/jobs/2466903
typing: add a few type hints to `mercurial/utils/urlutil.py`
Somewhere between hg
3dbc7b1ecaba and hg
8e3f6b5bf720, `_pathsuboptions` changed
from `Dict[bytes, Tuple[bytes, Any]]` to `Dict[bytes, Tuple[str, Any]]`, and it
caught my attention from diffing the local *.pyi files. The change is correct
based on the assertion, so let's get pytype to check for this instead of relying
on the assertion alone.
typing: add type hints to `mercurial/utils/resourceutil.py`
The `except` path requires byte args (because of the byte based manipulation in
`_package_path()`), while the `else` case tolerates `AnyStr`. Pytype was unable
to figure this out, and we should make sure the interface is the same for all
environments.
Added signature for changeset
11f41248595b
Added tag 6.8 for changeset
11f41248595b
test-check: don't report distutils as a local import
On python 3.12 this is wrongly reported as a local import. So we adjust the
checker to avoid it.
Backed out changeset
f28c52a9f7b4
This backout and the previous are due to a large performance regression
detected in repositories with a lot of obsmarkers when performing a clone.
A better fix will come along at the start of the next cycle.