remotefilelog: fix to use new manifestlog functions

Summary:
readfast and readdelta have moved onto the manifestctx structures in upstream
hg, so let's change remotefilelog to use them.

This breaks the ability for this version of remotefilelog to work with old
versions of Mercurial, but we never really guaranteed this to begin with.

Test Plan: Ran the tests, they now pass

Reviewers: #sourcecontrol

Subscribers: mjpieters

Differential Revision: https://phabricator.intern.facebook.com/D3915785
This commit is contained in:
Durham Goode 2016-09-23 13:28:36 -07:00
parent 230550558a
commit a07c114b8d
2 changed files with 8 additions and 7 deletions

View File

@ -60,7 +60,7 @@ class remotefilectx(context.filectx):
path = self._path
fileid = self._fileid
cl = self._repo.unfiltered().changelog
ma = self._repo.manifest
mfl = self._repo.manifestlog
for rev in range(len(cl) - 1, 0, -1):
node = cl.node(rev)
@ -68,7 +68,7 @@ class remotefilectx(context.filectx):
if path in data[3]: # checking the 'files' field.
# The file has been touched, check if the hash is what we're
# looking for.
if fileid == ma.readfast(data[0]).get(path):
if fileid == mfl[data[0]].readfast().get(path):
return rev
# Couldn't find the linkrev. This should generally not happen, and will
@ -178,7 +178,7 @@ class remotefilectx(context.filectx):
"""
repo = self._repo
cl = repo.unfiltered().changelog
ma = repo.manifest
mfl = repo.manifestlog
ancestormap = self.ancestormap()
p1, p2, linknode, copyfrom = ancestormap[fnode]
@ -215,7 +215,7 @@ class remotefilectx(context.filectx):
if path in ac[3]: # checking the 'files' field.
# The file has been touched, check if the content is
# similar to the one we search for.
if fnode == ma.readfast(ac[0]).get(path):
if fnode == mfl[ac[0]].readfast().get(path):
return cl.node(a)
return linknode

View File

@ -90,8 +90,9 @@ def wraprepo(repo):
localrevs = repo
mf = repo.manifest
mfl = repo.manifestlog
if base is not None:
mfdict = mf.read(repo[base].manifestnode())
mfdict = mfl[repo[base].manifestnode()].read()
skip = set(mfdict.iteritems())
else:
skip = set()
@ -115,9 +116,9 @@ def wraprepo(repo):
# When possible, only read the deltas.
p1, p2 = mf.parentrevs(mfrev)
if p1 in visited and p2 in visited:
mfdict = mf.readfast(mfnode)
mfdict = mfl[mfnode].readfast()
else:
mfdict = mf.read(mfnode)
mfdict = mfl[mfnode].read()
diff = mfdict.iteritems()
if pats: