comparison hgext/git/gitlog.py @ 52473:cdb45eb77efb

git: drop the zope `repository.ifilestorage` decoration on `gitlog.filelog` The next logical step is to disable the conditional import of `zope` in the `mercurial.interfaces.util` module, and just run with the no-op decorators. But doing that then generates these pytype errors: File "/mnt/c/Users/Matt/hg/hgext/git/gitlog.py", line 485, in read: No attribute 'gitrepo' on filelog [attribute-error] File "/mnt/c/Users/Matt/hg/hgext/git/gitlog.py", line 495, in lookup: No attribute 'gitrepo' on filelog [attribute-error] File "/mnt/c/Users/Matt/hg/hgext/git/gitlog.py", line 505, in add: No attribute 'gitrepo' on filelog [attribute-error] File "/mnt/c/Users/Matt/hg/hgext/git/gitlog.py", line 508, in __iter__: No attribute '_db' on filelog [attribute-error] File "/mnt/c/Users/Matt/hg/hgext/git/gitlog.py", line 522, in rev: No attribute '_db' on filelog [attribute-error] File "/mnt/c/Users/Matt/hg/hgext/git/gitlog.py", line 534, in node: No attribute '_db' on filelog [attribute-error] File "/mnt/c/Users/Matt/hg/hgext/git/gitlog.py", line 549, in parents: No attribute '_db' on filelog [attribute-error] File "/mnt/c/Users/Matt/hg/hgext/git/gitlog.py", line 556, in parents: No attribute '_db' on filelog [attribute-error] File "/mnt/c/Users/Matt/hg/hgext/git/gitlog.py", line 564, in parents: No attribute 'gitrepo' on filelog [attribute-error] File "/mnt/c/Users/Matt/hg/hgext/git/gitlog.py", line 564, in parents: No attribute '_db' on filelog [attribute-error] I'm not sure what exactly the issue is, but the pyi file that was being generated up to this point has `filelog` typed as `Any` (because it had a decorator, and pytype chokes on that), and `baselog` was typed as a class. So it apparently can't see the `_db` and `gitrepo` attributes of the subclass, because it doesn't think `filelog` is a class. Leave the decorator commented out so it hits when searching for the remaining zope things that need to be updated to Protocol.
author Matt Harbison <matt_harbison@yahoo.com>
date Sat, 07 Dec 2024 20:15:11 -0500
parents f4733654f144
children 3daaa5195a30
comparison
equal deleted inserted replaced
52472:0cc50d9ac6b0 52473:cdb45eb77efb
14 dagop, 14 dagop,
15 encoding, 15 encoding,
16 error, 16 error,
17 manifest, 17 manifest,
18 pycompat, 18 pycompat,
19 )
20 from mercurial.interfaces import (
21 repository,
22 util as interfaceutil,
23 ) 19 )
24 from mercurial.utils import stringutil 20 from mercurial.utils import stringutil
25 from . import ( 21 from . import (
26 gitutil, 22 gitutil,
27 index, 23 index,
469 te = t[p] 465 te = t[p]
470 t = self.gitrepo[te.id] 466 t = self.gitrepo[te.id]
471 return gitmanifest.gittreemanifestctx(self.gitrepo, t) 467 return gitmanifest.gittreemanifestctx(self.gitrepo, t)
472 468
473 469
474 @interfaceutil.implementer(repository.ifilestorage) 470 # @interfaceutil.implementer(repository.ifilestorage)
475 class filelog(baselog): 471 class filelog(baselog):
476 def __init__(self, gr, db, path): 472 def __init__(self, gr, db, path):
477 super(filelog, self).__init__(gr, db) 473 super(filelog, self).__init__(gr, db)
478 assert isinstance(path, bytes) 474 assert isinstance(path, bytes)
479 self.path = path 475 self.path = path