Patchwork [1,of,7] help: document about "grep" template keywords

login
register
mail settings
Submitter Yuya Nishihara
Date Oct. 7, 2018, 2:32 p.m.
Message ID <b1f2c9e00be3c547fc09.1538922744@mimosa>
Download mbox | patch
Permalink /patch/35533/
State New
Headers show

Comments

Yuya Nishihara - Oct. 7, 2018, 2:32 p.m.
# HG changeset patch
# User Yuya Nishihara <yuya@tcha.org>
# Date 1538920212 -32400
#      Sun Oct 07 22:50:12 2018 +0900
# Node ID b1f2c9e00be3c547fc094ba25eb84db6e965adef
# Parent  096471a93102d7578376efa22544ae1b0d69339b
help: document about "grep" template keywords

Patch

diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -2645,6 +2645,26 @@  def grep(ui, repo, pattern, *pats, **opt
     the repository are searched, including those that don't exist in the
     current branch or have been deleted in a prior changeset.
 
+    .. container:: verbose
+
+      Template:
+
+      The following keywords are supported in addition to the common template
+      keywords and functions. See also :hg:`help templates`.
+
+      :change:  String. Character denoting insertion ``+`` or removal ``-``.
+                Available if ``--diff`` is specified.
+      :lineno:  Integer. Line number of the match.
+      :path:    String. Repository-absolute path of the file.
+      :texts:   List of text chunks.
+
+      And each entry of ``{texts}`` provides the following sub-keywords.
+
+      :matched: Boolean. True if the chunk matches the specified pattern.
+      :text:    String. Chunk content.
+
+      See :hg:`help templates.operators` for the list expansion syntax.
+
     Returns 0 if a match is found, 1 otherwise.
     """
     opts = pycompat.byteskwargs(opts)