Mercurial > public > mercurial-scm > hg-stable
diff hgext/git/manifest.py @ 52523:db6efd74cf14
git: add missing `repository.imanifestdict` methods to `gittreemanifest`
The next logical step was to explicitly subclass `repository.imanifestdict`, but
pytype flagged a few missing methods, because they're marked abstract.
File "/mnt/c/Users/Matt/hg/hgext/git/manifest.py", line 238, in copy:
Can't instantiate gittreemanifest with abstract methods dirs, fastdelta, set [not-instantiable]
File "/mnt/c/Users/Matt/hg/hgext/git/manifest.py", line 287, in read:
Can't instantiate gittreemanifest with abstract methods dirs, fastdelta, set [not-instantiable]
File "/mnt/c/Users/Matt/hg/hgext/git/manifest.py", line 309, in read:
Can't instantiate gittreemanifest with abstract methods dirs, fastdelta, set [not-instantiable]
I'm not bothering to figure out how to implement them- add them to appease
pytype, and put a TODO to fill in a proper implementation later.
author | Matt Harbison <matt_harbison@yahoo.com> |
---|---|
date | Wed, 11 Dec 2024 02:02:34 -0500 |
parents | 48cdbd4d5443 |
children | 6412dcec52d3 |
line wrap: on
line diff
--- a/hgext/git/manifest.py Wed Dec 11 01:00:59 2024 -0500 +++ b/hgext/git/manifest.py Wed Dec 11 02:02:34 2024 -0500 @@ -4,6 +4,7 @@ from typing import ( Any, + Iterable, Iterator, Set, ) @@ -117,6 +118,9 @@ def __iter__(self) -> Iterator[bytes]: return self.iterkeys() + def set(self, path: bytes, node: bytes, flags: bytes) -> None: + raise NotImplementedError # TODO: implement this + def __setitem__(self, path: bytes, node: bytes) -> None: self._pending_changes[path] = node, self.flags(path) @@ -135,6 +139,9 @@ def _dirs(self): return pathutil.dirs(self) + def dirs(self) -> pathutil.dirs: + return self._dirs # TODO: why is there a prpoertycache? + def hasdir(self, dir: bytes) -> bool: return dir in self._dirs @@ -258,6 +265,11 @@ # TODO can this method move out of the manifest iface? raise NotImplementedError + def fastdelta( + self, base: ByteString, changes: Iterable[tuple[bytes, bool]] + ) -> tuple[ByteString, ByteString]: + raise NotImplementedError # TODO: implement this + def _walkonetree(self, tree, match, subdir): for te in tree: # TODO: can we prune dir walks with the matcher?