Bug in 'hg diff'

Guido Ostkamp hg at ostkamp.fastmail.fm
Tue Jul 24 11:58:22 CDT 2007


Hello,

> You're misreading -b:
>
>    $ hg help diff
>    [...]
>     -b --ignore-space-change  ignore changes in the amount of white space
>                                                     ^^^^^^

Obviously this help text is very confusing. I would interpret the 
introduction of new whitespace as a change in the "amount" from 0 to n 
whitespace chars.


> -w (which is what I think you want) also works for me:
>
>    $ sed -e 's/^This/    This/' testfile > testfile.new && mv testfile.new testfile
>    $ hg diff -b
>    diff --git a/testfile b/testfile
>    --- a/testfile
>    +++ b/testfile
>    @@ -1,3 +1,3 @@ This is a test.
>    -This is a test.
>    -This is another test.
>    -This is a third test.
>    +    This is    a test.
>    +    This is    another test.
>    +    This is    a third test.
>    $ hg diff -w

Maybe you overlooked that the output you listed above is again from 'hg 
diff -b', not '-w' (or it was a mistake copying the stuff to the mail).

When I call it with '-w' option, I get

$ hg diff -w testfile
diff -r 06a8711119f9 testfile
--- a/testfile  Mon Jul 23 23:45:23 2007 +0200
+++ b/testfile  Tue Jul 24 18:42:00 2007 +0200
@@ -1,3 +1,4 @@ This is a test.
   This is a test.
-This is another test.
-This is a third test.
+    This is another test.
+    This is a third test.
+Blablabla

This is exactly the same result as with '-b' and it is wrong as whitespace 
is apparently not ignored (I am using hg version 4106dde15aed+20070723).

It should behave as if called with regular 'diff -w' (without 'hg') as 
listed in my earlier mail.

Could you check, please?

Regards

Guido


More information about the Mercurial mailing list