Mon, 19 Aug 2024 22:27:43 -0400 typing: make the manifest classes known to pytype
Matt Harbison <matt_harbison@yahoo.com> [Mon, 19 Aug 2024 22:27:43 -0400] rev 51823
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.
Mon, 19 Aug 2024 22:21:16 -0400 typing: make the filelog class known to pytype
Matt Harbison <matt_harbison@yahoo.com> [Mon, 19 Aug 2024 22:21:16 -0400] rev 51822
typing: make the filelog class known to pytype These are the same changes as c1d7ac70980b and 45270e286bdc made to dirstate, for the same reasons.
Wed, 21 Aug 2024 17:41:57 -0400 remotefilelog: adapt the `debugindex` command to past API changes
Matt Harbison <matt_harbison@yahoo.com> [Wed, 21 Aug 2024 17:41:57 -0400] rev 51821
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()`.
Wed, 21 Aug 2024 16:13:14 -0400 typing: add type hints to the `opener` attributes and arguments of revlog
Matt Harbison <matt_harbison@yahoo.com> [Wed, 21 Aug 2024 16:13:14 -0400] rev 51820
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.
Wed, 21 Aug 2024 16:09:22 -0400 remotefilelog: honor the `--format` arg of the `debugindex` command
Matt Harbison <matt_harbison@yahoo.com> [Wed, 21 Aug 2024 16:09:22 -0400] rev 51819
remotefilelog: honor the `--format` arg of the `debugindex` command Flagged by PyCharm while investigating pytype spew. The other `**opts` above are already accessed as str. I've never used remotefilelog, and don't have a repo to test this on, so I'm trusting the nearby code.
Wed, 07 Aug 2024 22:05:36 +0200 merge: sort filemap only if requested by the caller stable
Manuel Jacob <me@manueljacob.de> [Wed, 07 Aug 2024 22:05:36 +0200] rev 51818
merge: sort filemap only if requested by the caller The name `sorted` refers to a built-in function, which is always true, so the else branch of this if statement was dead code. Because, with this fix, the function can iterate over the dict items while yielding values, the dict should not change size while the generator is running. Because of that, it is required to re-introduce code that makes a caller copy the filemap before modification, which was removed in 3c783ff08d40cbaf36eb27ffe1d296718c0f1d77 (that changeset also introduced the filemap() method including the bug that’s being fixed by this changeset).
Tue, 20 Aug 2024 22:47:11 -0400 shelve: consistently convert exception to bytes via `stringutil.forcebytestr`
Matt Harbison <matt_harbison@yahoo.com> [Tue, 20 Aug 2024 22:47:11 -0400] rev 51817
shelve: consistently convert exception to bytes via `stringutil.forcebytestr` The other two places in this module use this, and past experience shows that this method does a nicer job. I'm not sure why we're converting to bytes here- `KeyError` is built-in and will have str attrs, and `RepoLookupError` is a subclass of the built-in `Exception` class (not `errors.Error`, which is allegedly the baseclass for all Mercurial exceptions).
Tue, 20 Aug 2024 22:34:51 -0400 typing: add type hints to `mercurial.shelve`
Matt Harbison <matt_harbison@yahoo.com> [Tue, 20 Aug 2024 22:34:51 -0400] rev 51816
typing: add type hints to `mercurial.shelve` Pytype wasn't flagging anything here yet, but PyCharm was really unhappy about the usage of `state` objects being passed to various methods that accessed attrs on it, without any obvious attrs on the class because there's no contructor. Filling that out made PyCharm happy, and a few other things needed to be filled in to make that easier, so I made a pass over the whole file and filled in the trivial hints. The other repo, ui, context, matcher, and pats items can be filled in after the context and match modules are typed.
(0) -30000 -10000 -3000 -1000 -300 -100 -30 -10 -8 +8 +10 +30 +100 +300 tip