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.
I will repeat my position as stated on IRC. I am against this change because,
I'm the instigator of the IRC discussion, so I'll summarize my reasoning here as well.
Based on years of working on various sw projects, I've concluded that about 90% of the time I want to grep $PWD and the remaining 10% of the time I want to grep the whole repo. (It is possible that my usage is very weird, but I'm pretty sure I'm not the only one.)
While I agree that consistency is important, usability is also important. If the common operation is to grep the $PWD (and that is what happens if you run grep -R or git grep or many other "grepping" tools), then it should be the default for "hg grep".
I realize that the new "hg grep" behavior hasn't even made it into a release yet, and therefore usage data is essentially non-existent.
I lean towards searching the whole repo by default, for the reasons that Jordi listed, especially consistency with other hg commands.
I almost never hg grep from the command line, and typically search in TortoiseHg instead. But there, I always want it to search everything by default, unless I start passing -X. (I realize a change here doesn't mean it has to change in thg, just relaying my typical usage and expectations.)
I do think a config option to swap the default is reasonable, if for no other reason than $PWD is chosen for the default, and I can still get the behavior I'd expect.
There seems to have been no activities on this Diff for the past 3 Months.
By policy, we are automatically moving it out of the need-review state.
Please, move it back to need-review without hesitation if this diff should still be discussed.