Mercurial > public > mercurial-scm > hg
changeset 52616:b798ad65ced8
git: add stubs for dirstate methods
$ hg log
** unknown exception encountered, please report by visiting
** https://mercurial-scm.org/wiki/BugTracker
** Python 3.11.10 (main, Oct 31 2024, 01:10:40) [Clang 18.1.5 (https://github.com/llvm/llvm-project.git llvmorg-18.1.5-0-g617a15
** Mercurial Distributed SCM (version 6.9.post1.dev337+hg.72af9fa34832)
** Extensions loaded: absorb, churn, git (pygit2 1.14.1), githelp, gpg, hgk, histedit, patchbomb, rebase
Traceback (most recent call last):
File "/home/jeffpc/src/oss/hg-gitext-test/../hg-gitext/hg", line 61, in <module>
dispatch.run()
...
File "/usr/home/jeffpc/src/oss/hg-gitext/mercurial/localrepo.py", line 1789, in changelog
repo.dirstate.prefetch_parents()
^^^^^^^^^^^^^
File "/usr/home/jeffpc/src/oss/hg-gitext/mercurial/localrepo.py", line 225, in __get__
return super(unfilteredpropertycache, self).__get__(unfi)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/home/jeffpc/src/oss/hg-gitext/mercurial/util.py", line 1822, in __get__
result = self.func(obj)
^^^^^^^^^^^^^^
File "/usr/home/jeffpc/src/oss/hg-gitext/mercurial/localrepo.py", line 1802, in dirstate
self._dirstate = self._makedirstate()
^^^^^^^^^^^^^^^^^^^^
File "/usr/home/jeffpc/src/oss/hg-gitext/hgext/git/__init__.py", line 311, in _makedirstate
return dirstate.gitdirstate(
^^^^^^^^^^^^^^^^^^^^^
TypeError: Can't instantiate abstract class gitdirstate with abstract methods _checkexec, _ignorefileandline, changing_files, clear, copy, hasdir, invalidate, is_changing_files, rebuild, verify
author | Josef 'Jeff' Sipek <jeffpc@josefsipek.net> |
---|---|
date | Thu, 02 Jan 2025 10:46:37 -0500 |
parents | 78b2894cd58c |
children | a26c5da900ff |
files | hgext/git/dirstate.py |
diffstat | 1 files changed, 38 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext/git/dirstate.py Mon Dec 16 13:08:55 2024 +0100 +++ b/hgext/git/dirstate.py Thu Jan 02 10:46:37 2025 -0500 @@ -270,10 +270,22 @@ ) return path + def is_changing_files(self) -> bool: + raise NotImplementedError + + def _ignorefileandline(self, f: bytes) -> intdirstate.IgnoreFileAndLineT: + raise NotImplementedError + @property def _checklink(self) -> bool: return util.checklink(os.path.dirname(pycompat.fsencode(self.git.path))) + def invalidate(self) -> None: + raise NotImplementedError + + def copy(self, source: Optional[bytes], dest: bytes) -> None: + raise NotImplementedError + def copies(self) -> Dict[bytes, bytes]: # TODO support copies? return {} @@ -293,6 +305,17 @@ # correctly stage/revert index edits. return False + def clear(self) -> None: + raise NotImplementedError + + def rebuild( + self, + parent: bytes, + allfiles: Iterable[bytes], # TODO: more than iterable? (uses len()) + changedfiles: Optional[Iterable[bytes]] = None, + ) -> None: + raise NotImplementedError + def write(self, tr: Optional[intdirstate.TransactionT]) -> None: # TODO: call parent change callbacks @@ -410,11 +433,21 @@ # TODO pass + def _checkexec(self) -> bool: + raise NotImplementedError + @contextlib.contextmanager def changing_parents(self, repo): # TODO: track this maybe? yield + @contextlib.contextmanager + def changing_files(self, repo) -> Iterator: # TODO: typehint this + raise NotImplementedError + + def hasdir(self, d: bytes) -> bool: + raise NotImplementedError + def addparentchangecallback( self, category: bytes, callback: intdirstate.AddParentChangeCallbackT ) -> None: @@ -427,3 +460,8 @@ raise error.Abort( b'git repos do not support branches. try using bookmarks' ) + + def verify( + self, m1, m2, p1: bytes, narrow_matcher: Optional[Any] = None + ) -> Iterator[bytes]: + raise NotImplementedError