grep: rewrite help to better document current (confusing) behavior stable
authorKevin Bullock <kbullock+mercurial@ringworld.org>
Fri, 23 Sep 2016 12:45:10 -0500
branchstable
changeset 30009 7fa011555046
parent 29862 e7766022a61a
child 30010 149433e68974
grep: rewrite help to better document current (confusing) behavior
mercurial/commands.py
tests/test-globalopts.t
tests/test-help.t
tests/test-hgweb-json.t
--- a/mercurial/commands.py	Fri Sep 02 20:15:37 2016 +0000
+++ b/mercurial/commands.py	Fri Sep 23 12:45:10 2016 -0500
@@ -4288,20 +4288,23 @@
     _('[OPTION]... PATTERN [FILE]...'),
     inferrepo=True)
 def grep(ui, repo, pattern, *pats, **opts):
-    """search for a pattern in specified files and revisions
-
-    Search revisions of files for a regular expression.
-
-    This command behaves differently than Unix grep. It only accepts
-    Python/Perl regexps. It searches repository history, not the
-    working directory. It always prints the revision number in which a
-    match appears.
-
-    By default, grep only prints output for the first revision of a
+    """search revision history for a pattern in specified files
+
+    Search revision history for a regular expression in the specified
+    files or the entire project.
+
+    By default, grep prints the most recent revision number for each
     file in which it finds a match. To get it to print every revision
-    that contains a change in match status ("-" for a match that
-    becomes a non-match, or "+" for a non-match that becomes a match),
-    use the --all flag.
+    that contains a change in match status ("-" for a match that becomes
+    a non-match, or "+" for a non-match that becomes a match), use the
+    --all flag.
+
+    PATTERN can be any Python (roughly Perl-compatible) regular
+    expression.
+
+    If no FILEs are specified (and -f/--follow isn't set), all files in
+    the repository are searched, including those that don't exist in the
+    current branch or have been deleted in a prior changeset.
 
     Returns 0 if a match is found, 1 otherwise.
     """
--- a/tests/test-globalopts.t	Fri Sep 02 20:15:37 2016 +0000
+++ b/tests/test-globalopts.t	Fri Sep 23 12:45:10 2016 -0500
@@ -307,7 +307,7 @@
    files         list tracked files
    forget        forget the specified files on the next commit
    graft         copy changes from other branches onto the current branch
-   grep          search for a pattern in specified files and revisions
+   grep          search revision history for a pattern in specified files
    heads         show branch heads
    help          show help for a given topic or a help overview
    identify      identify the working directory or specified revision
@@ -390,7 +390,7 @@
    files         list tracked files
    forget        forget the specified files on the next commit
    graft         copy changes from other branches onto the current branch
-   grep          search for a pattern in specified files and revisions
+   grep          search revision history for a pattern in specified files
    heads         show branch heads
    help          show help for a given topic or a help overview
    identify      identify the working directory or specified revision
--- a/tests/test-help.t	Fri Sep 02 20:15:37 2016 +0000
+++ b/tests/test-help.t	Fri Sep 23 12:45:10 2016 -0500
@@ -69,7 +69,7 @@
    files         list tracked files
    forget        forget the specified files on the next commit
    graft         copy changes from other branches onto the current branch
-   grep          search for a pattern in specified files and revisions
+   grep          search revision history for a pattern in specified files
    heads         show branch heads
    help          show help for a given topic or a help overview
    identify      identify the working directory or specified revision
@@ -146,7 +146,7 @@
    files         list tracked files
    forget        forget the specified files on the next commit
    graft         copy changes from other branches onto the current branch
-   grep          search for a pattern in specified files and revisions
+   grep          search revision history for a pattern in specified files
    heads         show branch heads
    help          show help for a given topic or a help overview
    identify      identify the working directory or specified revision
@@ -784,7 +784,7 @@
    files         list tracked files
    forget        forget the specified files on the next commit
    graft         copy changes from other branches onto the current branch
-   grep          search for a pattern in specified files and revisions
+   grep          search revision history for a pattern in specified files
    heads         show branch heads
    help          show help for a given topic or a help overview
    identify      identify the working directory or specified revision
@@ -2186,7 +2186,7 @@
   grep
   </a>
   </td><td>
-  search for a pattern in specified files and revisions
+  search revision history for a pattern in specified files
   </td></tr>
   <tr><td>
   <a href="/help/heads">
--- a/tests/test-hgweb-json.t	Fri Sep 02 20:15:37 2016 +0000
+++ b/tests/test-hgweb-json.t	Fri Sep 23 12:45:10 2016 -0500
@@ -1467,7 +1467,7 @@
         "topic": "graft"
       },
       {
-        "summary": "search for a pattern in specified files and revisions",
+        "summary": "search revision history for a pattern in specified files",
         "topic": "grep"
       },
       {