Mercurial > hg
diff mercurial/manifest.py @ 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 | f4733654f144 |
children | 35400ce47b64 |
line wrap: on
line diff
--- a/mercurial/manifest.py Sat Aug 03 01:33:13 2024 -0400 +++ b/mercurial/manifest.py Wed Sep 18 17:46:46 2024 -0400 @@ -1793,7 +1793,7 @@ def fulltextcache(self): return self._fulltextcache - def clearcaches(self, clear_persisted_data=False): + def clearcaches(self, clear_persisted_data: bool = False) -> None: self._revlog.clearcaches() self._fulltextcache.clear(clear_persisted_data=clear_persisted_data) self._dirlogcache = {self.tree: self}