# HG changeset patch # User Matt Harbison # Date 2024-12-11 07:02:34 # Node ID db6efd74cf148233d8867e0ec01c072daf1b0139 # Parent 3913f9509476160567f6c9115c9783d411ed8978 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. diff --git a/hgext/git/manifest.py b/hgext/git/manifest.py --- a/hgext/git/manifest.py +++ b/hgext/git/manifest.py @@ -4,6 +4,7 @@ import typing from typing import ( Any, + Iterable, Iterator, Set, ) @@ -117,6 +118,9 @@ class gittreemanifest: 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 @@ class gittreemanifest: 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 @@ class gittreemanifest: # 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?