typing: lock in new pytype gains from making revlog related classes typeable
These were pretty clean changes in the pyi files from earlier in this series, so
add them to the code to make it more understandable.
There's one more trivial hint that can be added to the return of
`mercurial.revlogutils.rewrite._filelog_from_filename()`, however it needs to be
imported from '..' under the conditional of `typing.TYPE_CHECKING`, and that
seems to confuse the import checker- possibly because there's already an import
block from that level. (I would have expected a message about multiple import
statements in this case, but got one about higher level imports should come
first, no matter where I put the import statement.)
typing: add types to `revlog.revlogproblem`
These attrs showed as `Any` after the previous commit made the class visible to
pytype.
typing: make the revlog classes known to pytype
These are the same changes as
c1d7ac70980b and
45270e286bdc made to dirstate,
for the same reasons.
typing: make the manifest classes known to pytype
These are the same changes as
c1d7ac70980b and
45270e286bdc made to dirstate,
for the same reasons. The migration away from decorating the classes with
`@interfaceutil.implementer` was started back in
3e9a660b074a, but missed one.
typing: make the filelog class known to pytype
These are the same changes as
c1d7ac70980b and
45270e286bdc made to dirstate,
for the same reasons.
remotefilelog: adapt the `debugindex` command to past API changes
Pytype was missing these problems because it's currently inferring the classes
for `filelog` and `revlog` to be `Any`. When that's fixed, these were flagged,
so fix these first.
The `filelog` class used to subclass `revlog`, but that was changed back in
1541e1a8e87d (with most or all of the "lost" attributes being forwarded to the
embedded `revlog` attribute at that time). These forwarded references were
dropped over time, and this command has been broken at least as far back as
68282a7b29a7 when the `version` field was dropped. Most of the fixes were as
simple as calling the accessor for the embedded `revlog` member, but the general
delta feature detection was a bit more involved- I copied the detection for it
from `mercurial.revlogutils.debug.debug_revlog()`.
typing: add type hints to the `opener` attributes and arguments of revlog
When making revlog and filelog classes visible to pytype, it got confused quite
a bit in `mercurial/revlogutils/rewrite.py`, thinking it had a plain `Callable`,
and flagging additional methods on it like `join()` and `rename()`. I couldn't
figure out how it reduced to that (and PyCharm flagged `opener` references as
`Any`), but this makes it happy. So make this change before making the classes
visible.
The vfs class hierarchy is a bit wonky (e.g. `filteredvfs` is not a `vfs`), so
this may need to be revisited with a Protocol class that covers all of the `vfs`
classes. But for now, everything works.