[PATCH 1 of 4] graphlog: move creation of workingdir-parent nodes to displaygraph()
Yuya Nishihara
yuya at tcha.org
Thu Dec 3 14:26:44 UTC 2015
# HG changeset patch
# User Yuya Nishihara <yuya at tcha.org>
# Date 1447487115 -32400
# Sat Nov 14 16:45:15 2015 +0900
# Node ID aefccaa8788f27614d7b501abba00e28aa1d623f
# Parent 7df042d0784fe93017c766f76625ce8f77a8a6bc
graphlog: move creation of workingdir-parent nodes to displaygraph()
Future patches will make a node symbol templatable. Because arguments of a
templatekw function are repo and ctx, "showparents" list will have to be
built from a repo object by that function.
diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py
--- a/mercurial/cmdutil.py
+++ b/mercurial/cmdutil.py
@@ -2159,8 +2159,9 @@ def getlogrevs(repo, pats, opts):
return revs, expr, filematcher
-def displaygraph(ui, dag, displayer, showparents, edgefn, getrenamed=None,
+def displaygraph(ui, repo, dag, displayer, edgefn, getrenamed=None,
filematcher=None):
+ showparents = [ctx.node() for ctx in repo[None].parents()]
seen, state = [], graphmod.asciistate()
for rev, type, ctx, parents in dag:
char = 'o'
@@ -2202,9 +2203,8 @@ def graphlog(ui, repo, *pats, **opts):
endrev = scmutil.revrange(repo, opts.get('rev')).max() + 1
getrenamed = templatekw.getrenamedfn(repo, endrev=endrev)
displayer = show_changeset(ui, repo, opts, buffered=True)
- showparents = [ctx.node() for ctx in repo[None].parents()]
- displaygraph(ui, revdag, displayer, showparents,
- graphmod.asciiedges, getrenamed, filematcher)
+ displaygraph(ui, repo, revdag, displayer, graphmod.asciiedges, getrenamed,
+ filematcher)
def checkunsupportedgraphflags(pats, opts):
for op in ["newest_first"]:
diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -4696,8 +4696,7 @@ def incoming(ui, repo, source="default",
cmdutil.checkunsupportedgraphflags([], opts)
def display(other, chlist, displayer):
revdag = cmdutil.graphrevs(other, chlist, opts)
- showparents = [ctx.node() for ctx in repo[None].parents()]
- cmdutil.displaygraph(ui, revdag, displayer, showparents,
+ cmdutil.displaygraph(ui, repo, revdag, displayer,
graphmod.asciiedges)
hg._incoming(display, lambda: 1, ui, repo, source, opts, buffered=True)
@@ -5134,9 +5133,7 @@ def outgoing(ui, repo, dest=None, **opts
revdag = cmdutil.graphrevs(repo, o, opts)
displayer = cmdutil.show_changeset(ui, repo, opts, buffered=True)
- showparents = [ctx.node() for ctx in repo[None].parents()]
- cmdutil.displaygraph(ui, revdag, displayer, showparents,
- graphmod.asciiedges)
+ cmdutil.displaygraph(ui, repo, revdag, displayer, graphmod.asciiedges)
cmdutil.outgoinghooks(ui, repo, other, opts, o)
return 0
More information about the Mercurial-devel
mailing list