Diff ignoring whitespace for some commands

Ben Schmidt mail_ben_schmidt at yahoo.com.au
Tue Jan 10 23:12:18 UTC 2012


On 11/01/12 1:47 AM, Shane Turner wrote:
> On 10/01/2012 10:08 AM, 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?
>>
>> I couldn't find an answer on the web, so am turning to the experts on
>> the mailing list. Hope someone can help.
>>
>> Smiles,
>>
>> Ben.
>>
> From reading the hgweb.cgi file, it appears that you can point it at a
> custom config file by setting the "config" variable.
>
> In http://www.selenic.com/repo/hg-stable/file/tip/hgweb.cgi it's line 7.
>
> I would guess you could have the custom config with diff.ignorews=yes
> and your normal hgrc without it set.
>
> For what it's worth, I haven't tested this myself.

It's an hgweb config file, not a full hgrc. In an hgweb config file,
only the [web], [paths] and [collections] sections are used, so I can't
use a [diff] section to get the functionality I want.

But perhaps there is some other magic Python incantation I could add to
hgweb.cgi to override/add a config option for that invocation of the
app?

Ben.






More information about the Mercurial mailing list