Patchwork D7000: grep: enable all-files by default (BC)

login
register
mail settings
Submitter phabricator
Date Oct. 6, 2019, 4:15 p.m.
Message ID <differential-rev-PHID-DREV-ww5ffivqingjvmwgasm3-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/42033/
State New
Headers show

Comments

phabricator - Oct. 6, 2019, 4:15 p.m.
khanchi97 created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  This patch deprecates the `--all-files` flag and make the all-files
  behaviour as default.
  
  In test-grep.t, I removed '--all-files' from every command where it was
  used, to reflect that all-files behaviour is default and there is no
  change even after the removal.
  And other changes in test files are because of changed behaviour.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D7000

AFFECTED FILES
  mercurial/commands.py
  tests/test-grep.t

CHANGE DETAILS




To: khanchi97, #hg-reviewers
Cc: mercurial-devel
phabricator - Oct. 8, 2019, 5:58 p.m.
JordiGH added a comment.


  The docstring needs an update too.

INLINE COMMENTS

> commands.py:2742
>  
>      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

No longer by default! Or perhaps at all.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D7000/new/

REVISION DETAIL
  https://phab.mercurial-scm.org/D7000

To: khanchi97, #hg-reviewers
Cc: JordiGH, mercurial-devel
phabricator - Oct. 8, 2019, 6 p.m.
JordiGH added a comment.


  The docstring needs a significant update too. Would you like me to suggest something?

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D7000/new/

REVISION DETAIL
  https://phab.mercurial-scm.org/D7000

To: khanchi97, #hg-reviewers
Cc: JordiGH, mercurial-devel
phabricator - Oct. 8, 2019, 7:46 p.m.
khanchi97 added a comment.


  Sure :)

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D7000/new/

REVISION DETAIL
  https://phab.mercurial-scm.org/D7000

To: khanchi97, #hg-reviewers
Cc: JordiGH, mercurial-devel
phabricator - Oct. 18, 2019, 3:26 p.m.
JordiGH added a comment.


  In D7000#103065 <https://phab.mercurial-scm.org/D7000#103065>, @khanchi97 wrote:
  
  > Sure :)
  
  How about something like this?
  
    # HG changeset patch
    # User Jordi GutiƩrrez Hermoso <jordigh@octave.org>
    # Date 1571411921 14400
    #      Fri Oct 18 11:18:41 2019 -0400
    # Node ID 86cafc9dec2660561f65ec17d043f3117767a9a8
    # Parent  8c0fe77f47c5956681238b79dc15093c92e79395
    grep: update docs to reflect new --all-files default
    
    These docs no longer even mention the old weird behaviour that was
    poorly understood and underutilised. I think this undocumentation
    effectively deprecates it.
    
    diff --git a/mercurial/commands.py b/mercurial/commands.py
    --- a/mercurial/commands.py
    +++ b/mercurial/commands.py
    @@ -3276,7 +3276,7 @@ statemod.addunfinished(
                 b'diff',
                 None,
                 _(
    -                b'print all revisions when the term was introduced '
    +                b'search commit differences for when the term was added '
                     b'or removed'
                 ),
             ),
    @@ -3302,7 +3302,7 @@ statemod.addunfinished(
                 b'r',
                 b'rev',
                 [],
    -            _(b'only search files changed within revision range'),
    +            _(b'search files changed within revision range'),
                 _(b'REV'),
             ),
             (
    @@ -3324,16 +3324,19 @@ statemod.addunfinished(
         intents={INTENT_READONLY},
     )
     def grep(ui, repo, pattern, *pats, **opts):
    -    """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
    -    --diff flag.
    +    """search for a pattern in specified files
    +
    +    Search the working directory or revision history for a regular
    +    expression in the specified files or the entire project.
    +
    +    By default, grep searches the repository files in the working
    +    directory and prints the files where it finds a match. To specify
    +    historical revisions instead of the working directory, use the
    +    --rev flag.
    +
    +    To search instead historical revision differences 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 --diff flag.
     
         PATTERN can be any Python (roughly Perl-compatible) regular
         expression.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D7000/new/

REVISION DETAIL
  https://phab.mercurial-scm.org/D7000

To: khanchi97, #hg-reviewers
Cc: JordiGH, mercurial-devel
phabricator - Oct. 18, 2019, 3:40 p.m.
JordiGH added a comment.


  Wait, I found some problems, here is an amendment:
  
    # HG changeset patch
    # User Jordi GutiƩrrez Hermoso <jordigh@octave.org>
    # Date 1571411921 14400
    #      Fri Oct 18 11:18:41 2019 -0400
    # Node ID 60eb1feadbeebd2ddab16e0d1b4566dbf216333c
    # Parent  8c0fe77f47c5956681238b79dc15093c92e79395
    grep: update docs to reflect new --all-files default
    
    These docs no longer even mention the old weird behaviour that was
    poorly understood and underutilised. I think this undocumentation
    effectively deprecates it.
    
    diff --git a/mercurial/commands.py b/mercurial/commands.py
    --- a/mercurial/commands.py
    +++ b/mercurial/commands.py
    @@ -3276,7 +3276,7 @@ statemod.addunfinished(
                 b'diff',
                 None,
                 _(
    -                b'print all revisions when the term was introduced '
    +                b'search revision differences for when the pattern was added '
                     b'or removed'
                 ),
             ),
    @@ -3302,7 +3302,7 @@ statemod.addunfinished(
                 b'r',
                 b'rev',
                 [],
    -            _(b'only search files changed within revision range'),
    +            _(b'search files changed within revision range'),
                 _(b'REV'),
             ),
             (
    @@ -3324,23 +3324,27 @@ statemod.addunfinished(
         intents={INTENT_READONLY},
     )
     def grep(ui, repo, pattern, *pats, **opts):
    -    """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
    -    --diff flag.
    +    """search for a pattern in specified files
    +
    +    Search the working directory or revision history for a regular
    +    expression in the specified files for the entire project.
    +
    +    By default, grep searches the repository files in the working
    +    directory and prints the files where it finds a match. To specify
    +    historical revisions instead of the working directory, use the
    +    --rev flag.
    +
    +    To search instead historical revision differences 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 --diff 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.
    +    If no FILEs are specified and the --rev flag isn't supplied, all
    +    files in the working directory are searched. When using the --rev
    +    flag and specifying FILEs, use the --follow argument to also
    +    follow the specified FILEs across renames and copies.
     
         .. container:: verbose
     
    @@ -3363,6 +3367,7 @@ def grep(ui, repo, pattern, *pats, **opt
           See :hg:`help templates.operators` for the list expansion syntax.
     
         Returns 0 if a match is found, 1 otherwise.
    +
         """
         opts = pycompat.byteskwargs(opts)
         diff = opts.get(b'all') or opts.get(b'diff')

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D7000/new/

REVISION DETAIL
  https://phab.mercurial-scm.org/D7000

To: khanchi97, #hg-reviewers
Cc: JordiGH, mercurial-devel

Patch

diff --git a/tests/test-grep.t b/tests/test-grep.t
--- a/tests/test-grep.t
+++ b/tests/test-grep.t
@@ -27,10 +27,30 @@ 
   port:4:export
   port:4:vaportight
   port:4:import/export
+  port:3:export
+  port:3:vaportight
+  port:3:import/export
+  port:3:import/export
+  port:2:export
+  port:2:vaportight
+  port:2:import/export
+  port:1:import
+  port:1:export
+  port:0:import
   $ hg grep -r tip:0 port port
   port:4:export
   port:4:vaportight
   port:4:import/export
+  port:3:export
+  port:3:vaportight
+  port:3:import/export
+  port:3:import/export
+  port:2:export
+  port:2:vaportight
+  port:2:import/export
+  port:1:import
+  port:1:export
+  port:0:import
 
 simple from subdirectory
 
@@ -40,10 +60,30 @@ 
   port:4:export
   port:4:vaportight
   port:4:import/export
+  port:3:export
+  port:3:vaportight
+  port:3:import/export
+  port:3:import/export
+  port:2:export
+  port:2:vaportight
+  port:2:import/export
+  port:1:import
+  port:1:export
+  port:0:import
   $ hg grep -r tip:0 port --config ui.relative-paths=yes
   ../port:4:export
   ../port:4:vaportight
   ../port:4:import/export
+  ../port:3:export
+  ../port:3:vaportight
+  ../port:3:import/export
+  ../port:3:import/export
+  ../port:2:export
+  ../port:2:vaportight
+  ../port:2:import/export
+  ../port:1:import
+  ../port:1:export
+  ../port:0:import
   $ cd ..
 
 simple with color
@@ -53,6 +93,16 @@ 
   \x1b[0;35mport\x1b[0m\x1b[0;36m:\x1b[0m\x1b[0;34m4\x1b[0m\x1b[0;36m:\x1b[0mex\x1b[0;31;1mport\x1b[0m (esc)
   \x1b[0;35mport\x1b[0m\x1b[0;36m:\x1b[0m\x1b[0;34m4\x1b[0m\x1b[0;36m:\x1b[0mva\x1b[0;31;1mport\x1b[0might (esc)
   \x1b[0;35mport\x1b[0m\x1b[0;36m:\x1b[0m\x1b[0;34m4\x1b[0m\x1b[0;36m:\x1b[0mim\x1b[0;31;1mport\x1b[0m/ex\x1b[0;31;1mport\x1b[0m (esc)
+  \x1b[0;35mport\x1b[0m\x1b[0;36m:\x1b[0m\x1b[0;34m3\x1b[0m\x1b[0;36m:\x1b[0mex\x1b[0;31;1mport\x1b[0m (esc)
+  \x1b[0;35mport\x1b[0m\x1b[0;36m:\x1b[0m\x1b[0;34m3\x1b[0m\x1b[0;36m:\x1b[0mva\x1b[0;31;1mport\x1b[0might (esc)
+  \x1b[0;35mport\x1b[0m\x1b[0;36m:\x1b[0m\x1b[0;34m3\x1b[0m\x1b[0;36m:\x1b[0mim\x1b[0;31;1mport\x1b[0m/ex\x1b[0;31;1mport\x1b[0m (esc)
+  \x1b[0;35mport\x1b[0m\x1b[0;36m:\x1b[0m\x1b[0;34m3\x1b[0m\x1b[0;36m:\x1b[0mim\x1b[0;31;1mport\x1b[0m/ex\x1b[0;31;1mport\x1b[0m (esc)
+  \x1b[0;35mport\x1b[0m\x1b[0;36m:\x1b[0m\x1b[0;34m2\x1b[0m\x1b[0;36m:\x1b[0mex\x1b[0;31;1mport\x1b[0m (esc)
+  \x1b[0;35mport\x1b[0m\x1b[0;36m:\x1b[0m\x1b[0;34m2\x1b[0m\x1b[0;36m:\x1b[0mva\x1b[0;31;1mport\x1b[0might (esc)
+  \x1b[0;35mport\x1b[0m\x1b[0;36m:\x1b[0m\x1b[0;34m2\x1b[0m\x1b[0;36m:\x1b[0mim\x1b[0;31;1mport\x1b[0m/ex\x1b[0;31;1mport\x1b[0m (esc)
+  \x1b[0;35mport\x1b[0m\x1b[0;36m:\x1b[0m\x1b[0;34m1\x1b[0m\x1b[0;36m:\x1b[0mim\x1b[0;31;1mport\x1b[0m (esc)
+  \x1b[0;35mport\x1b[0m\x1b[0;36m:\x1b[0m\x1b[0;34m1\x1b[0m\x1b[0;36m:\x1b[0mex\x1b[0;31;1mport\x1b[0m (esc)
+  \x1b[0;35mport\x1b[0m\x1b[0;36m:\x1b[0m\x1b[0;34m0\x1b[0m\x1b[0;36m:\x1b[0mim\x1b[0;31;1mport\x1b[0m (esc)
 
 simple templated
 
@@ -61,16 +111,46 @@ 
   port:4:914fa752cdea:exPORT
   port:4:914fa752cdea:vaPORTight
   port:4:914fa752cdea:imPORT/exPORT
+  port:3:95040cfd017d:exPORT
+  port:3:95040cfd017d:vaPORTight
+  port:3:95040cfd017d:imPORT/exPORT
+  port:3:95040cfd017d:imPORT/exPORT
+  port:2:3b325e3481a1:exPORT
+  port:2:3b325e3481a1:vaPORTight
+  port:2:3b325e3481a1:imPORT/exPORT
+  port:1:8b20f75c1585:imPORT
+  port:1:8b20f75c1585:exPORT
+  port:0:f31323c92170:imPORT
 
   $ hg grep port -r tip:0 -T '{path}:{rev}:{texts}\n'
   port:4:export
   port:4:vaportight
   port:4:import/export
+  port:3:export
+  port:3:vaportight
+  port:3:import/export
+  port:3:import/export
+  port:2:export
+  port:2:vaportight
+  port:2:import/export
+  port:1:import
+  port:1:export
+  port:0:import
 
   $ hg grep port -r tip:0 -T '{path}:{tags}:{texts}\n'
   port:tip:export
   port:tip:vaportight
   port:tip:import/export
+  port::export
+  port::vaportight
+  port::import/export
+  port::import/export
+  port::export
+  port::vaportight
+  port::import/export
+  port::import
+  port::export
+  port::import
 
 simple JSON (no "change" field)
 
@@ -102,6 +182,96 @@ 
     "rev": 4,
     "texts": [{"matched": false, "text": "im"}, {"matched": true, "text": "port"}, {"matched": false, "text": "/ex"}, {"matched": true, "text": "port"}],
     "user": "spam"
+   },
+   {
+    "date": [3, 0],
+    "lineno": 1,
+    "node": "95040cfd017d658c536071c6290230a613c4c2a6",
+    "path": "port",
+    "rev": 3,
+    "texts": [{"matched": false, "text": "ex"}, {"matched": true, "text": "port"}],
+    "user": "eggs"
+   },
+   {
+    "date": [3, 0],
+    "lineno": 2,
+    "node": "95040cfd017d658c536071c6290230a613c4c2a6",
+    "path": "port",
+    "rev": 3,
+    "texts": [{"matched": false, "text": "va"}, {"matched": true, "text": "port"}, {"matched": false, "text": "ight"}],
+    "user": "eggs"
+   },
+   {
+    "date": [3, 0],
+    "lineno": 3,
+    "node": "95040cfd017d658c536071c6290230a613c4c2a6",
+    "path": "port",
+    "rev": 3,
+    "texts": [{"matched": false, "text": "im"}, {"matched": true, "text": "port"}, {"matched": false, "text": "/ex"}, {"matched": true, "text": "port"}],
+    "user": "eggs"
+   },
+   {
+    "date": [3, 0],
+    "lineno": 4,
+    "node": "95040cfd017d658c536071c6290230a613c4c2a6",
+    "path": "port",
+    "rev": 3,
+    "texts": [{"matched": false, "text": "im"}, {"matched": true, "text": "port"}, {"matched": false, "text": "/ex"}, {"matched": true, "text": "port"}],
+    "user": "eggs"
+   },
+   {
+    "date": [2, 0],
+    "lineno": 1,
+    "node": "3b325e3481a1f07435d81dfdbfa434d9a0245b47",
+    "path": "port",
+    "rev": 2,
+    "texts": [{"matched": false, "text": "ex"}, {"matched": true, "text": "port"}],
+    "user": "spam"
+   },
+   {
+    "date": [2, 0],
+    "lineno": 2,
+    "node": "3b325e3481a1f07435d81dfdbfa434d9a0245b47",
+    "path": "port",
+    "rev": 2,
+    "texts": [{"matched": false, "text": "va"}, {"matched": true, "text": "port"}, {"matched": false, "text": "ight"}],
+    "user": "spam"
+   },
+   {
+    "date": [2, 0],
+    "lineno": 3,
+    "node": "3b325e3481a1f07435d81dfdbfa434d9a0245b47",
+    "path": "port",
+    "rev": 2,
+    "texts": [{"matched": false, "text": "im"}, {"matched": true, "text": "port"}, {"matched": false, "text": "/ex"}, {"matched": true, "text": "port"}],
+    "user": "spam"
+   },
+   {
+    "date": [1, 0],
+    "lineno": 1,
+    "node": "8b20f75c158513ff5ac80bd0e5219bfb6f0eb587",
+    "path": "port",
+    "rev": 1,
+    "texts": [{"matched": false, "text": "im"}, {"matched": true, "text": "port"}],
+    "user": "eggs"
+   },
+   {
+    "date": [1, 0],
+    "lineno": 2,
+    "node": "8b20f75c158513ff5ac80bd0e5219bfb6f0eb587",
+    "path": "port",
+    "rev": 1,
+    "texts": [{"matched": false, "text": "ex"}, {"matched": true, "text": "port"}],
+    "user": "eggs"
+   },
+   {
+    "date": [0, 0],
+    "lineno": 1,
+    "node": "f31323c9217050ba245ee8b537c713ec2e8ab226",
+    "path": "port",
+    "rev": 0,
+    "texts": [{"matched": false, "text": "im"}, {"matched": true, "text": "port"}],
+    "user": "spam"
    }
   ]
 
@@ -116,6 +286,38 @@ 
     "path": "port",
     "rev": 4,
     "user": "spam"
+   },
+   {
+    "date": [3, 0],
+    "lineno": 1,
+    "node": "95040cfd017d658c536071c6290230a613c4c2a6",
+    "path": "port",
+    "rev": 3,
+    "user": "eggs"
+   },
+   {
+    "date": [2, 0],
+    "lineno": 1,
+    "node": "3b325e3481a1f07435d81dfdbfa434d9a0245b47",
+    "path": "port",
+    "rev": 2,
+    "user": "spam"
+   },
+   {
+    "date": [1, 0],
+    "lineno": 1,
+    "node": "8b20f75c158513ff5ac80bd0e5219bfb6f0eb587",
+    "path": "port",
+    "rev": 1,
+    "user": "eggs"
+   },
+   {
+    "date": [0, 0],
+    "lineno": 1,
+    "node": "f31323c9217050ba245ee8b537c713ec2e8ab226",
+    "path": "port",
+    "rev": 0,
+    "user": "spam"
    }
   ]
 
@@ -232,8 +434,17 @@ 
 
   $ hg grep -r tip:0 -l port port
   port:4
+  port:3
+  port:2
+  port:1
+  port:0
   $ hg grep -r tip:0 import port
   port:4:import/export
+  port:3:import/export
+  port:3:import/export
+  port:2:import/export
+  port:1:import
+  port:0:import
 
   $ hg cp port port2
   $ hg commit -m 4 -u spam -d '5 0'
@@ -241,8 +452,7 @@ 
 follow
 
   $ hg grep -r tip:0 --traceback -f 'import\n\Z' port2
-  port:0:import
-  
+  [1]
   $ echo deport >> port2
   $ hg commit -m 5 -u eggs -d '6 0'
   $ hg grep -f --all -nu port port2
@@ -269,6 +479,9 @@ 
   $ hg stat
   M port2
   $ hg grep -r 'wdir()' port
+  port:2147483647:export
+  port:2147483647:vaportight
+  port:2147483647:import/export
   port2:2147483647:export
   port2:2147483647:vaportight
   port2:2147483647:import/export
@@ -295,6 +508,7 @@ 
   $ hg ci -m 3
   $ hg grep -r tip:0 orange
   color:3:orange
+  color:1:orange
   $ hg grep --all orange
   color:3:+:orange
   color:2:-:orange
@@ -320,6 +534,12 @@ 
   [grep.filename|color][grep.sep|:][grep.rev|3][grep.sep|:][grep.match|b]lack
   [grep.filename|color][grep.sep|:][grep.rev|3][grep.sep|:][grep.match|o]range
   [grep.filename|color][grep.sep|:][grep.rev|3][grep.sep|:][grep.match|b]lue
+  [grep.filename|color][grep.sep|:][grep.rev|2][grep.sep|:][grep.match|b]lack
+  [grep.filename|color][grep.sep|:][grep.rev|1][grep.sep|:][grep.match|b]lue
+  [grep.filename|color][grep.sep|:][grep.rev|1][grep.sep|:][grep.match|b]lack
+  [grep.filename|color][grep.sep|:][grep.rev|1][grep.sep|:][grep.match|o]range
+  [grep.filename|color][grep.sep|:][grep.rev|0][grep.sep|:][grep.match|b]lue
+  [grep.filename|color][grep.sep|:][grep.rev|0][grep.sep|:][grep.match|b]lack
 
 match in last "line" without newline
 
@@ -431,39 +651,21 @@ 
   $ hg ci -A -m "second commit"
   adding new
   $ hg grep -r "." "unmod"
-  [1]
-  $ hg grep -r "." "unmod" --all-files
   um:1:unmod
 
-With --all-files, the working directory is searched by default
+Working directory is searched by default
 
   $ echo modified >> new
-  $ hg grep --all-files mod
+  $ hg grep mod
   new:modified
   um:unmod
 
  which can be overridden by -rREV
 
-  $ hg grep --all-files -r. mod
+  $ hg grep -r. mod
   um:1:unmod
 
-commands.all-files can be negated by --no-all-files
-
-  $ hg grep --config commands.grep.all-files=True mod
-  new:modified
-  um:unmod
-  $ hg grep --config commands.grep.all-files=True --no-all-files mod
-  um:0:unmod
-
---diff --all-files makes no sense since --diff is the option to grep history
-
-  $ hg grep --diff --all-files um
-  abort: --diff and --all-files are mutually exclusive
-  [255]
-
-but --diff should precede the commands.grep.all-files option
-
-  $ hg grep --config commands.grep.all-files=True --diff mod
+  $ hg grep --diff mod
   um:0:+:unmod
 
   $ cd ..
@@ -515,18 +717,18 @@ 
 
   $ cd ..
 
-test -rMULTIREV with --all-files
+test -rMULTIREV
 
   $ cd sng
   $ hg rm um
   $ hg commit -m "deletes um"
-  $ hg grep -r "0:2" "unmod" --all-files
+  $ hg grep -r "0:2" "unmod"
   um:0:unmod
   um:1:unmod
-  $ hg grep -r "0:2" "unmod" --all-files um
+  $ hg grep -r "0:2" "unmod" um
   um:0:unmod
   um:1:unmod
-  $ hg grep -r "0:2" "unmod" --all-files "glob:**/um" # Check that patterns also work
+  $ hg grep -r "0:2" "unmod" "glob:**/um" # Check that patterns also work
   um:0:unmod
   um:1:unmod
   $ cd ..
diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -2725,7 +2725,7 @@ 
     ('r', 'rev', [],
      _('only search files changed within revision range'), _('REV')),
     ('', 'all-files', None,
-     _('include all files in the changeset while grepping (EXPERIMENTAL)')),
+     _('include all files in the changeset while grepping (DEPRECATED)')),
     ('u', 'user', None, _('list the author (long with -v)')),
     ('d', 'date', None, _('list the date (short with -q)')),
     ] + formatteropts + walkopts,
@@ -2776,14 +2776,12 @@ 
     """
     opts = pycompat.byteskwargs(opts)
     diff = opts.get('all') or opts.get('diff')
-    all_files = opts.get('all_files')
     if diff and opts.get('all_files'):
         raise error.Abort(_('--diff and --all-files are mutually exclusive'))
-    # TODO: remove "not opts.get('rev')" if --all-files -rMULTIREV gets working
-    if opts.get('all_files') is None and not opts.get('rev') and not diff:
-        # experimental config: commands.grep.all-files
-        opts['all_files'] = ui.configbool('commands', 'grep.all-files')
+    if opts.get('all_files') is None and not diff:
+        opts['all_files'] = True
     plaingrep = opts.get('all_files') and not opts.get('rev')
+    all_files = opts.get('all_files')
     if plaingrep:
         opts['rev'] = ['wdir()']