734 return True |
734 return True |
735 |
735 |
736 def parents(self): |
736 def parents(self): |
737 _path = self._path |
737 _path = self._path |
738 fl = self._filelog |
738 fl = self._filelog |
739 pl = [(_path, n, fl) for n in self._filelog.parents(self._filenode)] |
739 parents = self._filelog.parents(self._filenode) |
|
740 pl = [(_path, node, fl) for node in parents if node != nullid] |
740 |
741 |
741 r = self._filelog.renamed(self._filenode) |
742 r = self._filelog.renamed(self._filenode) |
742 if r: |
743 if r: |
743 pl[0] = (r[0], r[1], None) |
744 # - In the simple rename case, both parent are nullid, pl is empty. |
744 |
745 # - In case of merge, only one of the parent is null id and should |
745 return [filectx(self._repo, p, fileid=n, filelog=l) |
746 # be replaced with the rename information. This parent is -always- |
746 for p, n, l in pl if n != nullid] |
747 # the first one. |
|
748 # |
|
749 # As null id have alway been filtered out in the previous list |
|
750 # comprehension, inserting to 0 will always result in "replacing |
|
751 # first nullid parent with rename information. |
|
752 pl.insert(0, (r[0], r[1], None)) |
|
753 |
|
754 return [filectx(self._repo, p, fileid=n, filelog=l) for p, n, l in pl] |
747 |
755 |
748 def p1(self): |
756 def p1(self): |
749 return self.parents()[0] |
757 return self.parents()[0] |
750 |
758 |
751 def p2(self): |
759 def p2(self): |