##// END OF EJS Templates
graphlog: move and rename graphabledag to asciiformat
Peter Arrenbrecht -
r8838:e89b0530 default
parent child Browse files
Show More
@@ -20,6 +20,16 b' from mercurial.node import nullrev'
20 from mercurial import bundlerepo, changegroup, cmdutil, commands, extensions
20 from mercurial import bundlerepo, changegroup, cmdutil, commands, extensions
21 from mercurial import hg, url, util, graphmod
21 from mercurial import hg, url, util, graphmod
22
22
23 def asciiformat(ui, repo, revdag, opts):
24 """formats a changelog DAG walk for ASCII output"""
25 showparents = [ctx.node() for ctx in repo[None].parents()]
26 displayer = show_changeset(ui, repo, opts, buffered=True)
27 for (ctx, parents) in revdag:
28 displayer.show(ctx)
29 lines = displayer.hunk.pop(ctx.rev()).split('\n')[:-1]
30 char = ctx.node() in showparents and '@' or 'o'
31 yield (ctx.rev(), parents, char, lines)
32
23 def grapher(nodes):
33 def grapher(nodes):
24 """grapher for asciigraph on a list of nodes and their parents
34 """grapher for asciigraph on a list of nodes and their parents
25
35
@@ -248,7 +258,7 b' def graphlog(ui, repo, path=None, **opts'
248 else:
258 else:
249 revdag = graphmod.revisions(repo, start, stop)
259 revdag = graphmod.revisions(repo, start, stop)
250
260
251 graphdag = graphabledag(ui, repo, revdag, opts)
261 graphdag = asciiformat(ui, repo, revdag, opts)
252 ascii(ui, grapher(graphdag))
262 ascii(ui, grapher(graphdag))
253
263
254 def graphrevs(repo, nodes, opts):
264 def graphrevs(repo, nodes, opts):
@@ -258,15 +268,6 b' def graphrevs(repo, nodes, opts):'
258 nodes = nodes[:limit]
268 nodes = nodes[:limit]
259 return graphmod.nodes(repo, nodes)
269 return graphmod.nodes(repo, nodes)
260
270
261 def graphabledag(ui, repo, revdag, opts):
262 showparents = [ctx.node() for ctx in repo[None].parents()]
263 displayer = show_changeset(ui, repo, opts, buffered=True)
264 for (ctx, parents) in revdag:
265 displayer.show(ctx)
266 lines = displayer.hunk.pop(ctx.rev()).split('\n')[:-1]
267 char = ctx.node() in showparents and '@' or 'o'
268 yield (ctx.rev(), parents, char, lines)
269
270 def goutgoing(ui, repo, dest=None, **opts):
271 def goutgoing(ui, repo, dest=None, **opts):
271 """show the outgoing changesets alongside an ASCII revision graph
272 """show the outgoing changesets alongside an ASCII revision graph
272
273
@@ -292,7 +293,7 b' def goutgoing(ui, repo, dest=None, **opt'
292
293
293 o = repo.changelog.nodesbetween(o, revs)[0]
294 o = repo.changelog.nodesbetween(o, revs)[0]
294 revdag = graphrevs(repo, o, opts)
295 revdag = graphrevs(repo, o, opts)
295 graphdag = graphabledag(ui, repo, revdag, opts)
296 graphdag = asciiformat(ui, repo, revdag, opts)
296 ascii(ui, grapher(graphdag))
297 ascii(ui, grapher(graphdag))
297
298
298 def gincoming(ui, repo, source="default", **opts):
299 def gincoming(ui, repo, source="default", **opts):
@@ -341,7 +342,7 b' def gincoming(ui, repo, source="default"'
341
342
342 chlist = other.changelog.nodesbetween(incoming, revs)[0]
343 chlist = other.changelog.nodesbetween(incoming, revs)[0]
343 revdag = graphrevs(other, chlist, opts)
344 revdag = graphrevs(other, chlist, opts)
344 graphdag = graphabledag(ui, repo, revdag, opts)
345 graphdag = asciiformat(ui, repo, revdag, opts)
345 ascii(ui, grapher(graphdag))
346 ascii(ui, grapher(graphdag))
346
347
347 finally:
348 finally:
General Comments 0
You need to be logged in to leave comments. Login now