Mercurial > hg
view CONTRIBUTING @ 51872:5e79783d4bc7
revlog: make `clearcaches()` signature consistent with ManifestRevlog
I'm not sure if this a newly added bug, because of using a different version of
pytype, or if the recent work around avoiding the zope interface types in the
type checking phase (see 5eb98ea78fd7 and friends)... but pytype 2023.11.21
started flagging this series since it was last pushed ~6 weeks ago:
File "/mnt/c/Users/Matt/hg/mercurial/bundlerepo.py", line 204, in <module>:
Overriding method signature mismatch [signature-mismatch]
Base signature: 'def mercurial.manifest.ManifestRevlog.clearcaches(self, clear_persisted_data: Any = ...) -> None'.
Subclass signature: 'def mercurial.revlog.revlog.clearcaches(self) -> None'.
Not enough positional parameters in overriding method.
Maybe the multiple inheritance in `bundlerepo.bundlemanifest` is bad, but it
seems like a `ManifestRevlog` is-a `revlog`, even though the class hierarchy
isn't coded that way. Additionally, it looks like `revlog.clearcaches()` is
dealing with some persistent data, so maybe this is useful to have there anyway.
Also sprinkle some trivial type hints on the method, because there are other
`clearcaches()` definitions in the codebase with these hints, and I don't feel
like waiting for another pytype run to see if it cares that specifically about
the signature matching.
author | Matt Harbison <matt_harbison@yahoo.com> |
---|---|
date | Wed, 18 Sep 2024 17:46:46 -0400 |
parents | a492610a2fc1 |
children |
line wrap: on
line source
Our full contribution guidelines are in our wiki, please see: https://www.mercurial-scm.org/wiki/ContributingChanges If you just want a checklist to follow, you can go straight to https://www.mercurial-scm.org/wiki/ContributingChanges#Submission_checklist If you can't run the entire testsuite for some reason (it can be difficult on Windows), please at least run `contrib/check-code.py` on any files you've modified and run `python contrib/check-commit` on any commits you've made (for example, `python contrib/check-commit 273ce12ad8f1` will report some style violations on a very old commit).