Diff ignoring whitespace for some commands
Mads Kiilerich
mads at kiilerich.com
Tue Jan 10 14:37:08 UTC 2012
On 01/10/2012 03:08 PM, Ben Schmidt wrote:
> Hi,
>
> I added
>
> [diff]
> ignorews=yes
>
> to my hgrc because I want the output of hg diff and the display via
> hgweb.cgi and hg serve to ignore whitespace.
>
> However, it's also affecting Mq: patches are being created/refreshed
> also ignoring whitespace, so when they are applied they don't accurately
> represent my changes or restore the tree to exactly the same state as
> when the patch was created/refreshed.
>
> I want to ignore whitespace for viewing, to facilitate code review, but
> not for creating Mq patches (or changesets of anything else).
>
> How can I achieve this?
>
> I know I can give -b as a default parameter for hg diff without
> affecting other things, but is there a way I can specifically target hg
> serve and hgweb with a diff option? Or can I somehow exclude the option
> for Mq commands or something?
No, there is not different knobs for different parts of Mercurial.
The best way to do that would be to define aliases. The Mercurial idea
is that if you want standard behaviour then use the standard command,
and if you want custom behaviour then use custom commands. (But as you
have found there are a few exceptions to that rule.)
FWIW, I agree that it can be convenient to ignore whitespace, but
developers should also try to reduce the whitespace churn and it is thus
a bad idea to _always_ ignore whitespace changes. Patches should be
reviewed both ways.
/Mads
More information about the Mercurial
mailing list