Skip to content
Snippets Groups Projects
Commit 0a514e30 authored by durin42's avatar durin42
Browse files

overlay: add kludge to make sure we only ever give hexshas to dulwich

parent f6cd1f0e
No related branches found
No related tags found
No related merge requests found
......@@ -10,6 +10,11 @@
from mercurial.node import bin, hex, nullid
from mercurial import localrepo
def _maybehex(n):
if len(n) == 20:
return hex(n)
return n
class overlaymanifest(object):
def __init__(self, repo, sha):
self.repo = repo
......@@ -103,7 +108,7 @@
return self.fileid
def data(self):
blob = self.repo.handler.git.get_object(self.fileid)
blob = self.repo.handler.git.get_object(_maybehex(self.fileid))
return blob.data
class overlaychangectx(context.changectx):
......@@ -111,7 +116,7 @@
self.repo = repo
if not isinstance(sha, basestring):
sha = sha.hex()
self.commit = repo.handler.git.get_object(sha)
self.commit = repo.handler.git.get_object(_maybehex(sha))
self._overlay = getattr(repo, 'gitoverlay', repo)
self._rev = self._overlay.rev(bin(self.commit.id))
......@@ -185,7 +190,7 @@
if not gitrev:
# we've reached a revision we have
return self.base.parents(n)
commit = self.repo.handler.git.get_object(n)
commit = self.repo.handler.git.get_object(_maybehex(n))
def gitorhg(n):
hn = self.repo.handler.map_hg_get(hex(n))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment