Bitbucket is a code hosting site with unlimited public and private repositories. We're also free for small teams!

Close

Grepfile extension for Mercurial

Installing

[extensions]
grepfile = [path to]/grepfile.py

Usage

This extension adds a new command grepfile that search files for a regular expression.

Example:

hg grepfile -i -n ctx.walk

Similar commands and difference

hg grepfile regexp (this extension)

  • search files. not history.
  • behave linke git grep.
  • can search uncommitted changes.
  • can search other revision's file.

hg grep regexp

  • search history. not files.
  • behave like git log -S.
  • cannot search uncommitted changes. because, uncommitted changes are not history.

hg locate 'set:grep(regexp)'

  • faster than hg grepfile.
  • can search uncommitted changes.
  • can search other revision's file.
  • cannot display matched line, filename only.

hg locate | xargs grep regexp

  • require xargs command and grep command.
  • search features are more powerful, because grep command has many options.
  • cannot search other revision's files. current revision's files only.
  • slower than hg grepfile.

Recent activity

Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.