##// END OF EJS Templates
graph: add outputgraph() function, called by ascii() to print...
John Stiles -
r38167:24e51760 default
parent child Browse files
Show More
@@ -341,6 +341,22 b' def asciistate():'
341 'graphshorten': False,
341 'graphshorten': False,
342 }
342 }
343
343
344 def outputgraph(ui, graph):
345 """outputs an ASCII graph of a DAG
346
347 this is a helper function for 'ascii' below.
348
349 takes the following arguments:
350
351 - ui to write to
352 - graph data: list of { graph nodes/edges, text }
353
354 this function can be monkey-patched by extensions to alter graph display
355 without needing to mimic all of the edge-fixup logic in ascii()
356 """
357 for (ln, logstr) in graph:
358 ui.write((ln + logstr).rstrip() + "\n")
359
344 def ascii(ui, state, type, char, text, coldata):
360 def ascii(ui, state, type, char, text, coldata):
345 """prints an ASCII graph of the DAG
361 """prints an ASCII graph of the DAG
346
362
@@ -469,9 +485,8 b' def ascii(ui, state, type, char, text, c'
469
485
470 # print lines
486 # print lines
471 indentation_level = max(ncols, ncols + coldiff)
487 indentation_level = max(ncols, ncols + coldiff)
472 for (line, logstr) in zip(lines, text):
488 lines = ["%-*s " % (2 * indentation_level, "".join(line)) for line in lines]
473 ln = "%-*s %s" % (2 * indentation_level, "".join(line), logstr)
489 outputgraph(ui, zip(lines, text))
474 ui.write(ln.rstrip() + '\n')
475
490
476 # ... and start over
491 # ... and start over
477 state['lastcoldiff'] = coldiff
492 state['lastcoldiff'] = coldiff
General Comments 0
You need to be logged in to leave comments. Login now