##// END OF EJS Templates
graphlog: rename grapher to asciiedges
Peter Arrenbrecht -
r8839:bbfa21b6 default
parent child Browse files
Show More
@@ -30,8 +30,8 b' def asciiformat(ui, repo, revdag, opts):'
30 char = ctx.node() in showparents and '@' or 'o'
30 char = ctx.node() in showparents and '@' or 'o'
31 yield (ctx.rev(), parents, char, lines)
31 yield (ctx.rev(), parents, char, lines)
32
32
33 def grapher(nodes):
33 def asciiedges(nodes):
34 """grapher for asciigraph on a list of nodes and their parents
34 """adds edge info to ascii formatted changelog DAG walk suitable for ascii()
35
35
36 nodes must generate tuples (node, parents, char, lines) where
36 nodes must generate tuples (node, parents, char, lines) where
37 - parents must generate the parents of node, in sorted order,
37 - parents must generate the parents of node, in sorted order,
@@ -118,10 +118,10 b' def get_padding_line(ni, n_columns, edge'
118 line.extend(["|", " "] * (n_columns - ni - 1))
118 line.extend(["|", " "] * (n_columns - ni - 1))
119 return line
119 return line
120
120
121 def ascii(ui, grapher):
121 def ascii(ui, dag):
122 """prints an ASCII graph of the DAG returned by the grapher
122 """prints an ASCII graph of the DAG
123
123
124 grapher is a generator that emits tuples with the following elements:
124 dag is a generator that emits tuples with the following elements:
125
125
126 - Character to use as node's symbol.
126 - Character to use as node's symbol.
127 - List of lines to display as the node's text.
127 - List of lines to display as the node's text.
@@ -136,7 +136,7 b' def ascii(ui, grapher):'
136 """
136 """
137 prev_n_columns_diff = 0
137 prev_n_columns_diff = 0
138 prev_node_index = 0
138 prev_node_index = 0
139 for (node_ch, node_lines, node_index, edges, n_columns, n_columns_diff) in grapher:
139 for (node_ch, node_lines, node_index, edges, n_columns, n_columns_diff) in dag:
140
140
141 assert -2 < n_columns_diff < 2
141 assert -2 < n_columns_diff < 2
142 if n_columns_diff == -1:
142 if n_columns_diff == -1:
@@ -258,8 +258,8 b' def graphlog(ui, repo, path=None, **opts'
258 else:
258 else:
259 revdag = graphmod.revisions(repo, start, stop)
259 revdag = graphmod.revisions(repo, start, stop)
260
260
261 graphdag = asciiformat(ui, repo, revdag, opts)
261 fmtdag = asciiformat(ui, repo, revdag, opts)
262 ascii(ui, grapher(graphdag))
262 ascii(ui, asciiedges(fmtdag))
263
263
264 def graphrevs(repo, nodes, opts):
264 def graphrevs(repo, nodes, opts):
265 limit = cmdutil.loglimit(opts)
265 limit = cmdutil.loglimit(opts)
@@ -293,8 +293,8 b' def goutgoing(ui, repo, dest=None, **opt'
293
293
294 o = repo.changelog.nodesbetween(o, revs)[0]
294 o = repo.changelog.nodesbetween(o, revs)[0]
295 revdag = graphrevs(repo, o, opts)
295 revdag = graphrevs(repo, o, opts)
296 graphdag = asciiformat(ui, repo, revdag, opts)
296 fmtdag = asciiformat(ui, repo, revdag, opts)
297 ascii(ui, grapher(graphdag))
297 ascii(ui, asciiedges(fmtdag))
298
298
299 def gincoming(ui, repo, source="default", **opts):
299 def gincoming(ui, repo, source="default", **opts):
300 """show the incoming changesets alongside an ASCII revision graph
300 """show the incoming changesets alongside an ASCII revision graph
@@ -342,8 +342,8 b' def gincoming(ui, repo, source="default"'
342
342
343 chlist = other.changelog.nodesbetween(incoming, revs)[0]
343 chlist = other.changelog.nodesbetween(incoming, revs)[0]
344 revdag = graphrevs(other, chlist, opts)
344 revdag = graphrevs(other, chlist, opts)
345 graphdag = asciiformat(ui, repo, revdag, opts)
345 fmtdag = asciiformat(ui, repo, revdag, opts)
346 ascii(ui, grapher(graphdag))
346 ascii(ui, asciiedges(fmtdag))
347
347
348 finally:
348 finally:
349 if hasattr(other, 'close'):
349 if hasattr(other, 'close'):
General Comments 0
You need to be logged in to leave comments. Login now