output of "hg diff --ignore-all-space" differs from that of GNU diff; is this a bug?

Eric Hanchrow eric.hanchrow at gmail.com
Fri May 1 17:46:23 CDT 2009


I ran this script:

    #!/bin/sh

    # Demonstrate that hg diff ignores the --ignore-all-space option

    repos=$(mktemp -d)

    trap "rm -rf $repos" EXIT

    cd $repos
    hg init
    cat<<EOF  > TheFile
    Blather
    I haz a line
    EOF

    hg add TheFile
    hg commit -m "Create a file"

    cat<<EOF  > TheFile
            I haz a line
    EOF

    hg commit -m "Added lotta whitespace"

    echo "Here's Mercurial's diff..."
    hg diff --ignore-all-space -c1

    echo "Now here's GNU diff"
    hg cat -r0 TheFile > before
    hg cat -r1 TheFile > after
    diff --ignore-all-space --unified before after

I saw this output:

   Here's Mercurial's diff...
    diff -r 8bfed0972e2b -r c82b6050d7e5 TheFile
    --- a/TheFile       Fri May 01 15:44:33 2009 -0700
    +++ b/TheFile       Fri May 01 15:44:33 2009 -0700
    @@ -1,2 +1,1 @@
    -Blather
    -I haz a line
    +   I haz a line
    Now here's GNU diff
    --- before  2009-05-01 15:44:33.000000000 -0700
    +++ after   2009-05-01 15:44:33.000000000 -0700
    @@ -1,2 +1 @@
    -Blather
     I haz a line

Note that "hg diff" shows that the second line has changed, whereas
GNU diff doesn't.  Is this a bug?

(This is mercurial version c8c231da59c3, btw)


More information about the Mercurial mailing list