Bug in 'hg diff'

Will Maier willmaier at ml1.net
Mon Jul 23 17:24:06 CDT 2007


On Mon, Jul 23, 2007 at 11:57:51PM +0200, Guido Ostkamp wrote:
> it appears the '-b' option (ignore whitespace changes) of 'hg
> diff' is not working at all.

You're misreading -b:

    $ hg help diff
    [...]
     -b --ignore-space-change  ignore changes in the amount of white space
                                                     ^^^^^^

-b works for me:

    $ hg init ignore-ws
    $ cd ignore-ws/
    $ cat <<EOF > testfile
    > This is a test.
    > This is another test.
    > This is a third test.
    > EOF
    $ hg ci -Am "Add a file."
    adding testfile
    $ sed -e 's/is a/is    a/' testfile > testfile.new && mv testfile.new testfile 
    $ hg diff testfile 
    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.

-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

-- 

[Will Maier]-----------------[willmaier at ml1.net|http://www.lfod.us/]


More information about the Mercurial mailing list