mercurial/graphmod.py
changeset 31558 d0b9e9803caf
parent 31043 aea06029919e
child 32209 906da89821ce
--- a/mercurial/graphmod.py	Tue Mar 21 18:36:14 2017 -0400
+++ b/mercurial/graphmod.py	Mon Mar 20 11:50:55 2017 +0900
@@ -182,6 +182,9 @@
     knownparents = []
     newparents = []
     for ptype, parent in parents:
+        if parent == rev:
+            # self reference (should only be seen in null rev)
+            continue
         if parent in seen:
             knownparents.append(parent)
         else:
@@ -191,8 +194,7 @@
     ncols = len(seen)
     nextseen = seen[:]
     nextseen[nodeidx:nodeidx + 1] = newparents
-    edges = [(nodeidx, nextseen.index(p))
-             for p in knownparents if p != nullrev]
+    edges = [(nodeidx, nextseen.index(p)) for p in knownparents]
 
     seen[:] = nextseen
     while len(newparents) > 2: