Show More
@@ -2212,7 +2212,7 b' def _graphnodeformatter(ui, displayer):' | |||||
2212 | def displaygraph(ui, repo, dag, displayer, edgefn, getrenamed=None, |
|
2212 | def displaygraph(ui, repo, dag, displayer, edgefn, getrenamed=None, | |
2213 | filematcher=None): |
|
2213 | filematcher=None): | |
2214 | formatnode = _graphnodeformatter(ui, displayer) |
|
2214 | formatnode = _graphnodeformatter(ui, displayer) | |
2215 |
|
|
2215 | state = graphmod.asciistate() | |
2216 | for rev, type, ctx, parents in dag: |
|
2216 | for rev, type, ctx, parents in dag: | |
2217 | char = formatnode(repo, ctx) |
|
2217 | char = formatnode(repo, ctx) | |
2218 | copies = None |
|
2218 | copies = None | |
@@ -2230,7 +2230,7 b' def displaygraph(ui, repo, dag, displaye' | |||||
2230 | if not lines[-1]: |
|
2230 | if not lines[-1]: | |
2231 | del lines[-1] |
|
2231 | del lines[-1] | |
2232 | displayer.flush(ctx) |
|
2232 | displayer.flush(ctx) | |
2233 |
edges = edgefn(type, char, lines, se |
|
2233 | edges = edgefn(type, char, lines, state, rev, parents) | |
2234 | for type, char, lines, coldata in edges: |
|
2234 | for type, char, lines, coldata in edges: | |
2235 | graphmod.ascii(ui, state, type, char, lines, coldata) |
|
2235 | graphmod.ascii(ui, state, type, char, lines, coldata) | |
2236 | displayer.close() |
|
2236 | displayer.close() |
@@ -362,8 +362,9 b' def colored(dag, repo):' | |||||
362 | yield (cur, type, data, (col, color), edges) |
|
362 | yield (cur, type, data, (col, color), edges) | |
363 | seen = next |
|
363 | seen = next | |
364 |
|
364 | |||
365 |
def asciiedges(type, char, lines, se |
|
365 | def asciiedges(type, char, lines, state, rev, parents): | |
366 | """adds edge info to changelog DAG walk suitable for ascii()""" |
|
366 | """adds edge info to changelog DAG walk suitable for ascii()""" | |
|
367 | seen = state['seen'] | |||
367 | if rev not in seen: |
|
368 | if rev not in seen: | |
368 | seen.append(rev) |
|
369 | seen.append(rev) | |
369 | nodeidx = seen.index(rev) |
|
370 | nodeidx = seen.index(rev) | |
@@ -461,7 +462,7 b' def _getpaddingline(ni, n_columns, edges' | |||||
461 |
|
462 | |||
462 | def asciistate(): |
|
463 | def asciistate(): | |
463 | """returns the initial value for the "state" argument to ascii()""" |
|
464 | """returns the initial value for the "state" argument to ascii()""" | |
464 | return [0, 0] |
|
465 | return {'seen': [], 'lastcoldiff': 0, 'lastindex': 0} | |
465 |
|
466 | |||
466 | def ascii(ui, state, type, char, text, coldata): |
|
467 | def ascii(ui, state, type, char, text, coldata): | |
467 | """prints an ASCII graph of the DAG |
|
468 | """prints an ASCII graph of the DAG | |
@@ -519,8 +520,8 b' def ascii(ui, state, type, char, text, c' | |||||
519 | nodeline.extend([char, " "]) |
|
520 | nodeline.extend([char, " "]) | |
520 |
|
521 | |||
521 | nodeline.extend( |
|
522 | nodeline.extend( | |
522 |
_getnodelineedgestail(idx, state[ |
|
523 | _getnodelineedgestail(idx, state['lastindex'], ncols, coldiff, | |
523 |
state[ |
|
524 | state['lastcoldiff'], fix_nodeline_tail)) | |
524 |
|
525 | |||
525 | # shift_interline is the line containing the non-vertical |
|
526 | # shift_interline is the line containing the non-vertical | |
526 | # edges between this entry and the next |
|
527 | # edges between this entry and the next | |
@@ -562,5 +563,5 b' def ascii(ui, state, type, char, text, c' | |||||
562 | ui.write(ln.rstrip() + '\n') |
|
563 | ui.write(ln.rstrip() + '\n') | |
563 |
|
564 | |||
564 | # ... and start over |
|
565 | # ... and start over | |
565 |
state[ |
|
566 | state['lastcoldiff'] = coldiff | |
566 |
state[ |
|
567 | state['lastindex'] = idx |
General Comments 0
You need to be logged in to leave comments.
Login now