D7146: [RFC] grep: add config option to grep PWD by default

pulkit (Pulkit Goyal) phabricator at mercurial-scm.org
Tue Oct 22 16:07:23 UTC 2019


pulkit created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  This is motivated by a disscussion on IRC.
  
  TODO: need to add tests, register config option and add docs.
  
  Tests are not ran on this yet.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  mercurial/commands.py

CHANGE DETAILS

diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -3396,6 +3396,9 @@
 
     getfile = util.lrucachefunc(repo.file)
 
+    if (not pats and ui.configbool("grep", "pwd")):
+        pats = ('.',)
+
     def matchlines(body):
         begin = 0
         linenum = 0



To: pulkit, #hg-reviewers
Cc: mercurial-devel


More information about the Mercurial-devel mailing list