remotefilelog: avoid _fileid in remotefilelogctx

_fileid is only set in some cases. We should access the file node through
_filenode instead, which can compute the node from either the _fileid or the
_changeid. This will be useful in a future diff where we construct
remotefilelogctx with just a path and a commit hash, and not a file id.
This commit is contained in:
Durham Goode 2017-11-27 16:33:50 -08:00
parent 4a6289577f
commit 4467b77ca1

View File

@ -87,18 +87,18 @@ class remotefilectx(context.filectx):
@propertycache
def _linkrev(self):
if self._fileid == nullid:
if self._filenode == nullid:
return nullrev
ancestormap = self.ancestormap()
p1, p2, linknode, copyfrom = ancestormap[self._fileid]
p1, p2, linknode, copyfrom = ancestormap[self._filenode]
rev = self._repo.changelog.nodemap.get(linknode)
if rev is not None:
return rev
# Search all commits for the appropriate linkrev (slow, but uncommon)
path = self._path
fileid = self._fileid
fileid = self._filenode
cl = self._repo.unfiltered().changelog
mfl = self._repo.manifestlog
@ -483,7 +483,7 @@ class remotefilectx(context.filectx):
if self.rev() != introrev:
introctx = remotefilectx(self._repo, self._path,
changeid=introrev,
fileid=self._fileid,
fileid=self._filenode,
filelog=self._filelog,
ancestormap=self._ancestormap)