# HG changeset patch
# User Yuya Nishihara <y...@tcha.org>
# Date 1530450173 -32400
#      Sun Jul 01 22:02:53 2018 +0900
# Node ID 32caef1aff8134dc1ca37a7da9129fc865a4329d
# Parent  e86b388c13242726e2734a92e3b5ebaf6f6e6e48
grep: add support for log-like template keywords and functions

diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -2634,6 +2634,7 @@ def grep(ui, repo, pattern, *pats, **opt
             iter = [('', l) for l in states]
         for change, l in iter:
             fm.startitem()
+            fm.context(ctx=ctx)
             fm.data(node=fm.hexfunc(scmutil.binnode(ctx)))
 
             cols = [
diff --git a/tests/test-grep.t b/tests/test-grep.t
--- a/tests/test-grep.t
+++ b/tests/test-grep.t
@@ -53,6 +53,11 @@ simple templated
   port:4:vaportight
   port:4:import/export
 
+  $ hg grep port -T '{file}:{tags}:{texts}\n'
+  port:tip:export
+  port:tip:vaportight
+  port:tip:import/export
+
 simple JSON (no "change" field)
 
   $ hg grep -Tjson port
_______________________________________________
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel

Reply via email to