mercurial/revlog.py
changeset 17673 d686c6876ef6
parent 17672 474047947b8f
child 17674 e69274f8d444
--- a/mercurial/revlog.py	Thu Sep 20 19:00:59 2012 +0200
+++ b/mercurial/revlog.py	Mon Sep 03 14:12:45 2012 +0200
@@ -611,12 +611,14 @@
         count = len(self)
         if not count:
             return [nullrev]
-        ishead = [1] * (count + 1)
+        # we won't iter over filtered rev so nobody is a head at start
+        ishead = [0] * (count + 1)
         index = self.index
         for r in self:
+            ishead[r] = 1  # I may be an head
             e = index[r]
-            ishead[e[5]] = ishead[e[6]] = 0
-        return [r for r in xrange(count) if ishead[r]]
+            ishead[e[5]] = ishead[e[6]] = 0  # my parent are not
+        return [r for r, val in enumerate(ishead) if val]
 
     def heads(self, start=None, stop=None):
         """return the list of all nodes that have no children