changeset 38541:1e25782a7583

grep: add support for log-like template keywords and functions
author Yuya Nishihara <yuya@tcha.org>
date Sun, 01 Jul 2018 22:02:53 +0900
parents b1bbff1dd99a
children 475f5f86eaed
files mercurial/commands.py tests/test-grep.t
diffstat 2 files changed, 6 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- 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