identify: provide changectx to templater

This commit is contained in:
Yuya Nishihara 2017-06-26 09:37:16 +09:00
parent fad172bfb7
commit 87a9caa150
2 changed files with 9 additions and 0 deletions

View File

@ -2795,6 +2795,7 @@ def identify(ui, repo, source=None, rev=None,
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=None,
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()

View File

@ -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