Show More
@@ -21,7 +21,7 b' from mercurial import hg, scmutil, util,' | |||||
21 |
|
21 | |||
22 | ASCIIDATA = 'ASC' |
|
22 | ASCIIDATA = 'ASC' | |
23 |
|
23 | |||
24 | def asciiedges(seen, rev, parents): |
|
24 | def asciiedges(type, char, lines, seen, rev, parents): | |
25 | """adds edge info to changelog DAG walk suitable for ascii()""" |
|
25 | """adds edge info to changelog DAG walk suitable for ascii()""" | |
26 | if rev not in seen: |
|
26 | if rev not in seen: | |
27 | seen.append(rev) |
|
27 | seen.append(rev) | |
@@ -36,16 +36,33 b' def asciiedges(seen, rev, parents):' | |||||
36 | newparents.append(parent) |
|
36 | newparents.append(parent) | |
37 |
|
37 | |||
38 | ncols = len(seen) |
|
38 | ncols = len(seen) | |
39 | seen[nodeidx:nodeidx + 1] = newparents |
|
39 | nextseen = seen[:] | |
40 | edges = [(nodeidx, seen.index(p)) for p in knownparents] |
|
40 | nextseen[nodeidx:nodeidx + 1] = newparents | |
|
41 | edges = [(nodeidx, nextseen.index(p)) for p in knownparents] | |||
|
42 | ||||
|
43 | while len(newparents) > 2: | |||
|
44 | # ascii() only knows how to add or remove a single column between two | |||
|
45 | # calls. Nodes with more than two parents break this constraint so we | |||
|
46 | # introduce intermediate expansion lines to grow the active node list | |||
|
47 | # slowly. | |||
|
48 | edges.append((nodeidx, nodeidx)) | |||
|
49 | edges.append((nodeidx, nodeidx + 1)) | |||
|
50 | nmorecols = 1 | |||
|
51 | yield (type, char, lines, (nodeidx, edges, ncols, nmorecols)) | |||
|
52 | char = '\\' | |||
|
53 | lines = [] | |||
|
54 | nodeidx += 1 | |||
|
55 | ncols += 1 | |||
|
56 | edges = [] | |||
|
57 | del newparents[0] | |||
41 |
|
58 | |||
42 | if len(newparents) > 0: |
|
59 | if len(newparents) > 0: | |
43 | edges.append((nodeidx, nodeidx)) |
|
60 | edges.append((nodeidx, nodeidx)) | |
44 | if len(newparents) > 1: |
|
61 | if len(newparents) > 1: | |
45 | edges.append((nodeidx, nodeidx + 1)) |
|
62 | edges.append((nodeidx, nodeidx + 1)) | |
46 |
|
63 | nmorecols = len(nextseen) - ncols | ||
47 | nmorecols = len(seen) - ncols |
|
64 | seen[:] = nextseen | |
48 |
|
|
65 | yield (type, char, lines, (nodeidx, edges, ncols, nmorecols)) | |
49 |
|
66 | |||
50 | def fix_long_right_edges(edges): |
|
67 | def fix_long_right_edges(edges): | |
51 | for (i, (start, end)) in enumerate(edges): |
|
68 | for (i, (start, end)) in enumerate(edges): | |
@@ -276,7 +293,9 b' def generate(ui, dag, displayer, showpar' | |||||
276 | displayer.show(ctx) |
|
293 | displayer.show(ctx) | |
277 | lines = displayer.hunk.pop(rev).split('\n')[:-1] |
|
294 | lines = displayer.hunk.pop(rev).split('\n')[:-1] | |
278 | displayer.flush(rev) |
|
295 | displayer.flush(rev) | |
279 |
|
|
296 | edges = edgefn(type, char, lines, seen, rev, parents) | |
|
297 | for type, char, lines, coldata in edges: | |||
|
298 | ascii(ui, state, type, char, lines, coldata) | |||
280 | displayer.close() |
|
299 | displayer.close() | |
281 |
|
300 | |||
282 | def graphlog(ui, repo, *pats, **opts): |
|
301 | def graphlog(ui, repo, *pats, **opts): |
General Comments 0
You need to be logged in to leave comments.
Login now