##// END OF EJS Templates
workingfilectx: always use the same filelog, even for renames...
Benoit Boissinot -
r8528:4ddffb79 default
parent child Browse files
Show More
@@ -638,49 +638,36 b' class workingfilectx(filectx):'
638 638 def _changectx(self):
639 639 return workingctx(self._repo)
640 640
641 @propertycache
642 def _repopath(self):
643 return self._repo.dirstate.copied(self._path) or self._path
644
645 @propertycache
646 def _filelog(self):
647 return self._repo.file(self._repopath)
648
649 641 def __nonzero__(self):
650 642 return True
651 643
652 644 def __str__(self):
653 645 return "%s@%s" % (self.path(), self._changectx)
654 646
655 def filectx(self, fileid):
656 '''opens an arbitrary revision of the file without
657 opening a new filelog'''
658 return filectx(self._repo, self._repopath, fileid=fileid,
659 filelog=self._filelog)
660
661 def rev(self):
662 if '_changectx' in self.__dict__:
663 return self._changectx.rev()
664 return self._filelog.linkrev(self._filerev)
665
666 647 def data(self): return self._repo.wread(self._path)
667 648 def renamed(self):
668 rp = self._repopath
669 if rp == self._path:
649 rp = self._repo.dirstate.copied(self._path)
650 if not rp:
670 651 return None
671 652 return rp, self._changectx._parents[0]._manifest.get(rp, nullid)
672 653
673 654 def parents(self):
674 655 '''return parent filectxs, following copies if necessary'''
675 p = self._path
676 rp = self._repopath
677 pcl = self._changectx._parents
656 def filenode(ctx, path):
657 return ctx._manifest.get(path, nullid)
658
659 path = self._path
678 660 fl = self._filelog
679 pl = [(rp, pcl[0]._manifest.get(rp, nullid), fl)]
680 if len(pcl) > 1:
681 if rp != p:
682 fl = None
683 pl.append((p, pcl[1]._manifest.get(p, nullid), fl))
661 pcl = self._changectx._parents
662 renamed = self.renamed()
663
664 if renamed:
665 pl = [renamed + (None,)]
666 else:
667 pl = [(path, filenode(pcl[0], path), fl)]
668
669 for pc in pcl[1:]:
670 pl.append((path, filenode(pc, path), fl))
684 671
685 672 return [filectx(self._repo, p, fileid=n, filelog=l)
686 673 for p,n,l in pl if n != nullid]
General Comments 0
You need to be logged in to leave comments. Login now