This revision was automatically updated to reflect the committed changes.
Closed by commit rHGbfcd5c7cbf9a: grep: restore pre-9ef10437bb88 behavior, 
enable wdir search by tweakdefaults (authored by yuja, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D3919?vs=9536&id=9549

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

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

CHANGE DETAILS

diff --git a/tests/test-grep.t b/tests/test-grep.t
--- a/tests/test-grep.t
+++ b/tests/test-grep.t
@@ -456,10 +456,15 @@
 
   $ cd ..
 
-Change Default of grep, that is, the files not in current working directory
-should not be grepp-ed on
+Change Default of grep by ui.tweakdefaults, that is, the files not in current
+working directory should not be grepp-ed on
+
   $ hg init ab
   $ cd ab
+  $ cat <<'EOF' >> .hg/hgrc
+  > [ui]
+  > tweakdefaults = True
+  > EOF
   $ echo "some text">>file1
   $ hg add file1
   $ hg commit -m "adds file1"
diff --git a/mercurial/ui.py b/mercurial/ui.py
--- a/mercurial/ui.py
+++ b/mercurial/ui.py
@@ -59,6 +59,8 @@
 interface = curses
 
 [commands]
+# Grep working directory by default.
+grep.all-files = True
 # Make `hg status` emit cwd-relative paths by default.
 status.relative = yes
 # Refuse to perform an `hg update` that would cause a file content merge
diff --git a/mercurial/configitems.py b/mercurial/configitems.py
--- a/mercurial/configitems.py
+++ b/mercurial/configitems.py
@@ -188,7 +188,7 @@
     default=dynamicdefault,
 )
 coreconfigitem('commands', 'grep.all-files',
-    default=True,
+    default=False,
 )
 coreconfigitem('commands', 'show.aliasprefix',
     default=list,
diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -2515,12 +2515,11 @@
     Search revision history for a regular expression in the specified
     files or the entire project.
 
-    By default, grep searches the expression on the working directory.
-    To search history and show the most recent revision number for each
-    file in which it finds a match, use :hg:`grep -r tip:0`.
-    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.
+    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.
 
     PATTERN can be any Python (roughly Perl-compatible) regular
     expression.



To: yuja, #hg-reviewers, sangeet259, pulkit
Cc: mercurial-devel
_______________________________________________
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel

Reply via email to