Commits

Augie Fackler committed 1147976

hgit: adapt for hg 2.5

Comments (0)

Files changed (3)

 from mercurial import commands
 from mercurial import extensions
 from mercurial import hg
-from mercurial import repo
+from mercurial import peer
 from mercurial import util as hgutil
 
 from hgit import bookwrap
 from hgit import gitrepo
 
 
-class remotegitrepo(repo.repository):
+class remotegitrepo(peer.peerrepository):
     capabilities = ['git']
 
     def __init__(self, ui, path, create):
         self._revcache = {}
         self._cachedheads = []
         self._loaded = 0
+        self.filteredrevs = []
         gitlog.__init__(self, *args, **kwargs)
 
     def dag(self):
 from mercurial import localrepo
 from mercurial import lock
 from mercurial import node
-from mercurial import repo
 from mercurial import scmutil
 from mercurial import util as hgutil
 from mercurial.i18n import _
         pass
 
 
+class fakedirstatecache(object):
+    def refresh(self):
+        pass
+
+
 class localgitrepo(localrepo.localrepository):
     capabilities = set(('native-git',))
     supported = set()
+    filteredrevcache = {}
+
     def __init__(self, baseui, path=None, create=0):
-        repo.repository.__init__(self)
+        self._filecache = {'dirstate': fakedirstatecache(),
+                           }
+        self._branchcaches = {}
         self.invalidatecaches()
-        self._filecache = {} # We can just leave this empty, I think.
         self.root = os.path.realpath(hgutil.expandpath(path))
         self.path = os.path.join(self.root, '.git')
         self.hgpath = os.path.join(self.root, '.hg')
         self.auditor = scmutil.pathauditor(self.root, self._checkdotgit)
         self.opener = scmutil.opener(self.hgpath)
         self.wopener = scmutil.opener(self.root)
+        self.sopener = scmutil.opener(self.root)
         self.baseui = baseui
         self._phasedefaults = []
         self._dirtyphases = []
         if fn == '00changelog.i':
             return os.path.join(self.root, '.git', 'HEAD')
         elif fn == 'lock':
+            return os.path.join(self.root, '.git', 'hgit-bogus-lock')
             # TODO this is just a complete lie, and probably will lead
             # to concurrency bugs especially if cgit is in the mix
             return os.path.join(self.root, '.git', 'index.lock')
+        elif fn in ('obsstore', 'phaseroots'):
+            return os.path.join(self.root, '.hg', fn)
         raise NotImplementedError('Need to pick file for %s.' % fn)
 
     def _checkdotgit(self):