comparison mercurial/filelog.py @ 52518:ba8f03ad8906

filelog: subclass the new `repository.ifilestorage` Protocol class This is the same transformation as 3a90a6fd710d did for dirstate, but the CamelCase naming was already cleaned up here. See 4ef6dbc27a99 for the benefits of explicit subclassing. One thing to mention is that pytype gets confused if Protocol classes preceed a regular class in the superclass list, so the interface goes last in the git extension. (I didn't bother to verify that it would have been an issue here, rather it was something I noticed when making `repository.ipeerbase` a Protocol class locally before dropping it entirely earlier in this series.) One other thing is that PyCharm starts flagging `__len__()` and `hasnode()` on `hgext.git.gitlog.baselog` with: "Type of 'hasnode' is incompatible with 'ifilestorage'" No clue why; it's happy with the other 3 implementations (at least with these methods- simplestorerepo.py looks badly broken otherwise).
author Matt Harbison <matt_harbison@yahoo.com>
date Tue, 22 Oct 2024 23:36:48 -0400
parents 4ef6dbc27a99
children 5cc8deb96b48
comparison
equal deleted inserted replaced
52517:8c89e978375c 52518:ba8f03ad8906
26 constants as revlog_constants, 26 constants as revlog_constants,
27 rewrite, 27 rewrite,
28 ) 28 )
29 29
30 30
31 class filelog: # (repository.ifilestorage) 31 class filelog(repository.ifilestorage):
32 _revlog: revlog.revlog 32 _revlog: revlog.revlog
33 nullid: bytes 33 nullid: bytes
34 _fix_issue6528: bool 34 _fix_issue6528: bool
35 35
36 def __init__(self, opener, path, try_split=False): 36 def __init__(self, opener, path, try_split=False):