##// END OF EJS Templates
filectx.parents: filter nullrev parent sooner...
Pierre-Yves David -
r23688:20932983 default
parent child Browse files
Show More
@@ -736,14 +736,22 b' class basefilectx(object):'
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.
745 # - In case of merge, only one of the parent is null id and should
746 # be replaced with the rename information. This parent is -always-
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))
744
753
745 return [filectx(self._repo, p, fileid=n, filelog=l)
754 return [filectx(self._repo, p, fileid=n, filelog=l) for p, n, l in pl]
746 for p, n, l in pl if n != nullid]
747
755
748 def p1(self):
756 def p1(self):
749 return self.parents()[0]
757 return self.parents()[0]
General Comments 0
You need to be logged in to leave comments. Login now