comparison 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
comparison
equal deleted inserted replaced
28997:25d93c61cef4 28998:f303b569134c
399 nextseen = seen[:] 399 nextseen = seen[:]
400 nextseen[nodeidx:nodeidx + 1] = newparents 400 nextseen[nodeidx:nodeidx + 1] = newparents
401 edges = [(nodeidx, nextseen.index(p)) 401 edges = [(nodeidx, nextseen.index(p))
402 for p in knownparents if p != nullrev] 402 for p in knownparents if p != nullrev]
403 403
404 seen[:] = nextseen
404 while len(newparents) > 2: 405 while len(newparents) > 2:
405 # ascii() only knows how to add or remove a single column between two 406 # ascii() only knows how to add or remove a single column between two
406 # calls. Nodes with more than two parents break this constraint so we 407 # calls. Nodes with more than two parents break this constraint so we
407 # introduce intermediate expansion lines to grow the active node list 408 # introduce intermediate expansion lines to grow the active node list
408 # slowly. 409 # slowly.
420 if len(newparents) > 0: 421 if len(newparents) > 0:
421 edges.append((nodeidx, nodeidx)) 422 edges.append((nodeidx, nodeidx))
422 if len(newparents) > 1: 423 if len(newparents) > 1:
423 edges.append((nodeidx, nodeidx + 1)) 424 edges.append((nodeidx, nodeidx + 1))
424 nmorecols = len(nextseen) - ncols 425 nmorecols = len(nextseen) - ncols
425 seen[:] = nextseen
426 # remove current node from edge characters, no longer needed 426 # remove current node from edge characters, no longer needed
427 state['edges'].pop(rev, None) 427 state['edges'].pop(rev, None)
428 yield (type, char, lines, (nodeidx, edges, ncols, nmorecols)) 428 yield (type, char, lines, (nodeidx, edges, ncols, nmorecols))
429 429
430 def _fixlongrightedges(edges): 430 def _fixlongrightedges(edges):