The current implementation of grep in mercurial is quite counter-intuitive and not what most people would expect it to do. For example one of the most common things people want to do with grep is grep the current directory, but only files under hg control. But this is not the default behaviour of grep as of now.

There are other issues with the --all flag which reports irrelevant revisions in the output. This project aims at fixing these issues with the grep.

Goals of the project:

  • grep command by default should only search for the files tracked by the current working directory
  • If passed a revision like: hg grep -r then it should search on the files tracked by the revision sets passed
  • Introduce a --diff option to hg grep which does exactly what hg grep --all do right now
  • Deprecating the --all flag in favour of --diff.
  • Fixing and other similar issues marked duplicate of this
  • Documentation of all the above tasks


Sangeet Kumar Mishra


  • Pulkit Goyal
  • Kevin Bullock
  • Sean Farley