Mercurial > hg
changeset 9368:8a4773bcbaec
graphlog: extract some setup code out of common functions
author | Dirkjan Ochtman <dirkjan@ochtman.nl> |
---|---|
date | Thu, 20 Aug 2009 08:35:03 +0200 |
parents | 1ef630452e0b |
children | 20140c249e63 |
files | hgext/graphlog.py |
diffstat | 1 files changed, 11 insertions(+), 9 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext/graphlog.py Thu Aug 20 08:34:22 2009 +0200 +++ b/hgext/graphlog.py Thu Aug 20 08:35:03 2009 +0200 @@ -22,18 +22,14 @@ ASCIIDATA = 'ASC' -def asciiformat(ui, repo, revdag, opts, parentrepo=None): +def asciiformat(revdag, displayer, parents): """formats a changelog DAG walk for ASCII output""" - if parentrepo is None: - parentrepo = repo - showparents = [ctx.node() for ctx in parentrepo[None].parents()] - displayer = show_changeset(ui, repo, opts, buffered=True) for (id, type, ctx, parentids) in revdag: if type != graphmod.CHANGESET: continue displayer.show(ctx) lines = displayer.hunk.pop(ctx.rev()).split('\n')[:-1] - char = ctx.node() in showparents and '@' or 'o' + char = ctx.node() in parents and '@' or 'o' yield (id, ASCIIDATA, (char, lines), parentids) def asciiedges(nodes): @@ -259,7 +255,9 @@ else: revdag = graphmod.revisions(repo, start, stop) - fmtdag = asciiformat(ui, repo, revdag, opts) + displayer = show_changeset(ui, repo, opts, buffered=True) + showparents = [ctx.node() for ctx in repo[None].parents()] + fmtdag = asciiformat(revdag, displayer, showparents) ascii(ui, asciiedges(fmtdag)) def graphrevs(repo, nodes, opts): @@ -294,7 +292,9 @@ o = repo.changelog.nodesbetween(o, revs)[0] revdag = graphrevs(repo, o, opts) - fmtdag = asciiformat(ui, repo, revdag, opts) + displayer = show_changeset(ui, repo, opts, buffered=True) + showparents = [ctx.node() for ctx in repo[None].parents()] + fmtdag = asciiformat(revdag, displayer, showparents) ascii(ui, asciiedges(fmtdag)) def gincoming(ui, repo, source="default", **opts): @@ -343,7 +343,9 @@ chlist = other.changelog.nodesbetween(incoming, revs)[0] revdag = graphrevs(other, chlist, opts) - fmtdag = asciiformat(ui, other, revdag, opts, parentrepo=repo) + displayer = show_changeset(ui, other, opts, buffered=True) + showparents = [ctx.node() for ctx in repo[None].parents()] + fmtdag = asciiformat(revdag, displayer, showparents) ascii(ui, asciiedges(fmtdag)) finally: