Mercurial > hg > hg-git
changeset 1052:5db8d0d0ae47
compat: update for upcoming hg 4.4 release
This is a bit of a simplification of an earlier patch from Jun Wu
<quark@fb.com>.
author | Kevin Bullock <kbullock@ringworld.org> |
---|---|
date | Sun, 01 Oct 2017 12:51:49 +0100 |
parents | 7decccb79f8a |
children | 5821075b289a |
files | hggit/gitrepo.py |
diffstat | 1 files changed, 51 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/hggit/gitrepo.py +++ b/hggit/gitrepo.py @@ -1,21 +1,34 @@ from util import isgitsshuri from mercurial import util from mercurial.error import RepoError -from mercurial.peer import peerrepository + +peerapi = False +try: + from mercurial.repository import peer as peerrepository + peerapi = True +except ImportError: + from mercurial.peer import peerrepository class gitrepo(peerrepository): - capabilities = ['lookup'] - - def _capabilities(self): - return self.capabilities - def __init__(self, ui, path, create): if create: # pragma: no cover raise util.Abort('Cannot create a git repository.') - self.ui = ui + self._ui = ui self.path = path self.localrepo = None + _peercapabilities = ['lookup'] + + def _capabilities(self): + return self._peercapabilities + + def capabilities(self): + return self._peercapabilities + + @property + def ui(self): + return self._ui + def url(self): return self.path @@ -48,6 +61,37 @@ def pushkey(self, namespace, key, old, new): return False + if peerapi: + def branchmap(self): + raise NotImplementedError + + def canpush(self): + return True + + def close(self): + pass + + def debugwireargs(self): + raise NotImplementedError + + def getbundle(self): + raise NotImplementedError + + def iterbatch(self): + raise NotImplementedError + + def known(self): + raise NotImplementedError + + def peer(self): + return self + + def stream_out(self): + raise NotImplementedError + + def unbundle(self): + raise NotImplementedError + instance = gitrepo def islocal(path):