33 filelog=None, |
33 filelog=None, |
34 changectx=None, |
34 changectx=None, |
35 ancestormap=None, |
35 ancestormap=None, |
36 ): |
36 ): |
37 if fileid == nullrev: |
37 if fileid == nullrev: |
38 fileid = nullid |
38 fileid = repo.nullid |
39 if fileid and len(fileid) == 40: |
39 if fileid and len(fileid) == 40: |
40 fileid = bin(fileid) |
40 fileid = bin(fileid) |
41 super(remotefilectx, self).__init__( |
41 super(remotefilectx, self).__init__( |
42 repo, path, changeid, fileid, filelog, changectx |
42 repo, path, changeid, fileid, filelog, changectx |
43 ) |
43 ) |
76 def linkrev(self): |
76 def linkrev(self): |
77 return self._linkrev |
77 return self._linkrev |
78 |
78 |
79 @propertycache |
79 @propertycache |
80 def _linkrev(self): |
80 def _linkrev(self): |
81 if self._filenode == nullid: |
81 if self._filenode == self._repo.nullid: |
82 return nullrev |
82 return nullrev |
83 |
83 |
84 ancestormap = self.ancestormap() |
84 ancestormap = self.ancestormap() |
85 p1, p2, linknode, copyfrom = ancestormap[self._filenode] |
85 p1, p2, linknode, copyfrom = ancestormap[self._filenode] |
86 rev = self._repo.changelog.index.get_rev(linknode) |
86 rev = self._repo.changelog.index.get_rev(linknode) |
172 repo = self._repo |
172 repo = self._repo |
173 ancestormap = self.ancestormap() |
173 ancestormap = self.ancestormap() |
174 |
174 |
175 p1, p2, linknode, copyfrom = ancestormap[self._filenode] |
175 p1, p2, linknode, copyfrom = ancestormap[self._filenode] |
176 results = [] |
176 results = [] |
177 if p1 != nullid: |
177 if p1 != repo.nullid: |
178 path = copyfrom or self._path |
178 path = copyfrom or self._path |
179 flog = repo.file(path) |
179 flog = repo.file(path) |
180 p1ctx = remotefilectx( |
180 p1ctx = remotefilectx( |
181 repo, path, fileid=p1, filelog=flog, ancestormap=ancestormap |
181 repo, path, fileid=p1, filelog=flog, ancestormap=ancestormap |
182 ) |
182 ) |
183 p1ctx._descendantrev = self.rev() |
183 p1ctx._descendantrev = self.rev() |
184 results.append(p1ctx) |
184 results.append(p1ctx) |
185 |
185 |
186 if p2 != nullid: |
186 if p2 != repo.nullid: |
187 path = self._path |
187 path = self._path |
188 flog = repo.file(path) |
188 flog = repo.file(path) |
189 p2ctx = remotefilectx( |
189 p2ctx = remotefilectx( |
190 repo, path, fileid=p2, filelog=flog, ancestormap=ancestormap |
190 repo, path, fileid=p2, filelog=flog, ancestormap=ancestormap |
191 ) |
191 ) |
502 renamed = self.renamed() |
502 renamed = self.renamed() |
503 |
503 |
504 if renamed: |
504 if renamed: |
505 p1 = renamed |
505 p1 = renamed |
506 else: |
506 else: |
507 p1 = (path, pcl[0]._manifest.get(path, nullid)) |
507 p1 = (path, pcl[0]._manifest.get(path, self._repo.nullid)) |
508 |
508 |
509 p2 = (path, nullid) |
509 p2 = (path, self._repo.nullid) |
510 if len(pcl) > 1: |
510 if len(pcl) > 1: |
511 p2 = (path, pcl[1]._manifest.get(path, nullid)) |
511 p2 = (path, pcl[1]._manifest.get(path, self._repo.nullid)) |
512 |
512 |
513 m = {} |
513 m = {} |
514 if p1[1] != nullid: |
514 if p1[1] != self._repo.nullid: |
515 p1ctx = self._repo.filectx(p1[0], fileid=p1[1]) |
515 p1ctx = self._repo.filectx(p1[0], fileid=p1[1]) |
516 m.update(p1ctx.filelog().ancestormap(p1[1])) |
516 m.update(p1ctx.filelog().ancestormap(p1[1])) |
517 |
517 |
518 if p2[1] != nullid: |
518 if p2[1] != self._repo.nullid: |
519 p2ctx = self._repo.filectx(p2[0], fileid=p2[1]) |
519 p2ctx = self._repo.filectx(p2[0], fileid=p2[1]) |
520 m.update(p2ctx.filelog().ancestormap(p2[1])) |
520 m.update(p2ctx.filelog().ancestormap(p2[1])) |
521 |
521 |
522 copyfrom = b'' |
522 copyfrom = b'' |
523 if renamed: |
523 if renamed: |
524 copyfrom = renamed[0] |
524 copyfrom = renamed[0] |
525 m[None] = (p1[1], p2[1], nullid, copyfrom) |
525 m[None] = (p1[1], p2[1], self._repo.nullid, copyfrom) |
526 self._ancestormap = m |
526 self._ancestormap = m |
527 |
527 |
528 return self._ancestormap |
528 return self._ancestormap |