Bug in 'hg diff'

Guido Ostkamp hg at ostkamp.fastmail.fm
Mon Jul 23 16:57:51 CDT 2007


Hello,

it appears the '-b' option (ignore whitespace changes) of 'hg diff' is not 
working at all.

Example (I added 2 spaces in front of each example for easier reading):

I created & checked in a 'testfile':

   $ hg cat testfile
   This is a test.
   This is another test.
   This is a third test.

Now I edited & changed 'testfile', new contents are:

   This is a test.
       This is another test.
       This is a third test.
   Blablabla

Here is what 'hg' reports:

   $ hg diff -b testfile
   diff -r 06a8711119f9 testfile
   --- a/testfile  Mon Jul 23 23:45:23 2007 +0200
   +++ b/testfile  Mon Jul 23 23:51:22 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 wrong. The output should be like that from a regular diff:

   $ hg cat testfile  > /tmp/out1
   $ diff -w -u /tmp/out1 testfile
   --- /tmp/out1   2007-07-23 23:53:01.000000000 +0200
   +++ testfile    2007-07-23 23:45:37.000000000 +0200
   @@ -1,3 +1,4 @@
    This is a test.
    This is another test.
    This is a third test.
   +Blablabla

When ignoring whitespace, only the last line has changed.

This appears to be a clear bug to me, please have a look. Should I raise a 
bug report for this?

Regards

Guido


More information about the Mercurial mailing list