grep: add support for log-like template keywords and functions
authorYuya Nishihara <yuya@tcha.org>
Sun, 01 Jul 2018 22:02:53 +0900
changeset 38540 1e25782a7583
parent 38539 b1bbff1dd99a
child 38541 475f5f86eaed
grep: add support for log-like template keywords and functions
mercurial/commands.py
tests/test-grep.t
--- a/mercurial/commands.py	Sun Jul 01 21:47:43 2018 +0900
+++ b/mercurial/commands.py	Sun Jul 01 22:02:53 2018 +0900
@@ -2634,6 +2634,7 @@
             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 = [
--- a/tests/test-grep.t	Sun Jul 01 21:47:43 2018 +0900
+++ b/tests/test-grep.t	Sun Jul 01 22:02:53 2018 +0900
@@ -53,6 +53,11 @@
   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