Show More
@@ -100,13 +100,17 b' def get_padding_line(ni, n_columns, edge' | |||||
100 | line.extend(["|", " "] * (n_columns - ni - 1)) |
|
100 | line.extend(["|", " "] * (n_columns - ni - 1)) | |
101 | return line |
|
101 | return line | |
102 |
|
102 | |||
103 | def ascii(ui, base, type, char, text, coldata): |
|
103 | def asciistate(): | |
|
104 | """returns the initial value for the "state" argument to ascii()""" | |||
|
105 | return [0, 0] | |||
|
106 | ||||
|
107 | def ascii(ui, state, type, char, text, coldata): | |||
104 | """prints an ASCII graph of the DAG |
|
108 | """prints an ASCII graph of the DAG | |
105 |
|
109 | |||
106 | takes the following arguments (one call per node in the graph): |
|
110 | takes the following arguments (one call per node in the graph): | |
107 |
|
111 | |||
108 | - ui to write to |
|
112 | - ui to write to | |
109 |
- |
|
113 | - Somewhere to keep the needed state in (init to asciistate()) | |
110 | - Column of the current node in the set of ongoing edges. |
|
114 | - Column of the current node in the set of ongoing edges. | |
111 | - Type indicator of node data == ASCIIDATA. |
|
115 | - Type indicator of node data == ASCIIDATA. | |
112 | - Payload: (char, lines): |
|
116 | - Payload: (char, lines): | |
@@ -156,8 +160,8 b' def ascii(ui, base, type, char, text, co' | |||||
156 | nodeline.extend([char, " "]) |
|
160 | nodeline.extend([char, " "]) | |
157 |
|
161 | |||
158 | nodeline.extend( |
|
162 | nodeline.extend( | |
159 |
get_nodeline_edges_tail(idx, |
|
163 | get_nodeline_edges_tail(idx, state[1], ncols, coldiff, | |
160 |
|
|
164 | state[0], fix_nodeline_tail)) | |
161 |
|
165 | |||
162 | # shift_interline is the line containing the non-vertical |
|
166 | # shift_interline is the line containing the non-vertical | |
163 | # edges between this entry and the next |
|
167 | # edges between this entry and the next | |
@@ -199,8 +203,8 b' def ascii(ui, base, type, char, text, co' | |||||
199 | ui.write(ln.rstrip() + '\n') |
|
203 | ui.write(ln.rstrip() + '\n') | |
200 |
|
204 | |||
201 | # ... and start over |
|
205 | # ... and start over | |
202 |
|
|
206 | state[0] = coldiff | |
203 |
|
|
207 | state[1] = idx | |
204 |
|
208 | |||
205 | def get_revs(repo, rev_opt): |
|
209 | def get_revs(repo, rev_opt): | |
206 | if rev_opt: |
|
210 | if rev_opt: | |
@@ -217,12 +221,12 b' def check_unsupported_flags(opts):' | |||||
217 | raise util.Abort(_("--graph option is incompatible with --%s") % op) |
|
221 | raise util.Abort(_("--graph option is incompatible with --%s") % op) | |
218 |
|
222 | |||
219 | def generate(ui, dag, displayer, showparents, edgefn): |
|
223 | def generate(ui, dag, displayer, showparents, edgefn): | |
220 |
seen, |
|
224 | seen, state = [], asciistate() | |
221 | for rev, type, ctx, parents in dag: |
|
225 | for rev, type, ctx, parents in dag: | |
222 | char = ctx.node() in showparents and '@' or 'o' |
|
226 | char = ctx.node() in showparents and '@' or 'o' | |
223 | displayer.show(ctx) |
|
227 | displayer.show(ctx) | |
224 | lines = displayer.hunk.pop(rev).split('\n')[:-1] |
|
228 | lines = displayer.hunk.pop(rev).split('\n')[:-1] | |
225 |
ascii(ui, |
|
229 | ascii(ui, state, type, char, lines, edgefn(seen, rev, parents)) | |
226 |
|
230 | |||
227 | def graphlog(ui, repo, path=None, **opts): |
|
231 | def graphlog(ui, repo, path=None, **opts): | |
228 | """show revision history alongside an ASCII revision graph |
|
232 | """show revision history alongside an ASCII revision graph |
General Comments 0
You need to be logged in to leave comments.
Login now