[PATCH 3 of 3] identify: provide changectx to templater
Yuya Nishihara
yuya at tcha.org
Sun Jun 25 21:48:04 EDT 2017
# HG changeset patch
# User Yuya Nishihara <yuya at tcha.org>
# Date 1498437436 -32400
# Mon Jun 26 09:37:16 2017 +0900
# Node ID 6ec9639b1930a6433daac5f5332c494cb5e31917
# Parent 8407931dc104dd45e7c7d6661710e108c59ce001
identify: provide changectx to templater
diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -2795,6 +2795,7 @@ def identify(ui, repo, source=None, rev=
fn.startitem()
fn.data(rev=p.rev())
fn.data(node=p.hex())
+ fn.context(ctx=p)
fn.end()
else:
hexoutput = hexfunc(ctx.node())
@@ -2834,6 +2835,7 @@ def identify(ui, repo, source=None, rev=
fm.data(branch=ctx.branch())
fm.data(tags=fm.formatlist(taglist, name='tag', sep=':'))
fm.data(bookmarks=fm.formatlist(ctx.bookmarks(), name='bookmark'))
+ fm.context(ctx=ctx)
fm.plain("%s\n" % ' '.join(output))
fm.end()
diff --git a/tests/test-identify.t b/tests/test-identify.t
--- a/tests/test-identify.t
+++ b/tests/test-identify.t
@@ -56,6 +56,13 @@ with options
}
]
+test template keywords and functions which require changectx:
+
+ $ hg id -T '{rev} {node|shortest}\n'
+ 2147483647 ffff
+ $ hg id -T '{parents % "{rev} {node|shortest} {desc}\n"}'
+ 0 cb9a a
+
with modifications
$ echo b > a
More information about the Mercurial-devel
mailing list