Stephan
Stephan

Reputation: 3799

exclude directory in hg commands by default

I'm working in a project I used to do things like:

hg grep TODO

to find stuff that needs fixing for example. But now I have included source code from other projects and hg grep TODO becomes useless because of the existence of TODO's in the added source code projects which is not mine. Now I can add an parameter --exclude=frameworks to the command but typing that each time is annoying...

Upvotes: 2

Views: 377

Answers (2)

Idan K
Idan K

Reputation: 20901

The alias section of hgrc is suited for this. You could add this to your local .hgrc or if this is relevant for just this repository, to your .hg/hgrc:

[alias]
xgrep = grep --exclude=frameworks

Upvotes: 4

phihag
phihag

Reputation: 288260

A workaround is adding an alias in your shell's configuration file (for example ~/.bashrc) or profile (~/.profile):

alias hg-grep="hg grep --exclude=frameworks"

type . ~/.bashrc or just start a new shell to have the setting in effect. You'll get the behavior you want with hg-grep TODO, but can still use the original with hg grep TODO.

Upvotes: 0

Related Questions