diff mercurial/graphmod.py @ 28998:f303b569134c stable

graphmod: fix seen state handling for > 2 parents (issue5174) When there are more than 2 parents for a given node (in a sparse graph), extra dummy nodes are inserted to transition the lines more gradually. However, since the seen state was not updated when yielding the extra nodes, the wrong graph styles were being applied to the nodes.
author Martijn Pieters <mjpieters@fb.com>
date Wed, 20 Apr 2016 18:26:29 +0100
parents ac30adb260ea
children 8d5584d8345b
line wrap: on
line diff
--- a/mercurial/graphmod.py	Wed Apr 20 21:33:02 2016 +0000
+++ b/mercurial/graphmod.py	Wed Apr 20 18:26:29 2016 +0100
@@ -401,6 +401,7 @@
     edges = [(nodeidx, nextseen.index(p))
              for p in knownparents if p != nullrev]
 
+    seen[:] = nextseen
     while len(newparents) > 2:
         # ascii() only knows how to add or remove a single column between two
         # calls. Nodes with more than two parents break this constraint so we
@@ -422,7 +423,6 @@
     if len(newparents) > 1:
         edges.append((nodeidx, nodeidx + 1))
     nmorecols = len(nextseen) - ncols
-    seen[:] = nextseen
     # remove current node from edge characters, no longer needed
     state['edges'].pop(rev, None)
     yield (type, char, lines, (nodeidx, edges, ncols, nmorecols))