Bug in 'hg diff'
Will Maier
willmaier at ml1.net
Tue Jul 24 17:44:13 UTC 2007
On Tue, Jul 24, 2007 at 06:58:22PM +0200, Guido Ostkamp wrote:
> >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.
Taken with the explanation for -w, I think it's clear enough, though
I'm not authoritative.
> >-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).
No -- look at the bottom, where hg diff -w produces no output.
That's the point: you sound like you want to use -w, but you're
using -b. Why don't you use -w instead?
> 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).
I assume you made other, non-whitespace changes in that cset. In
combination white non-whitespace changes, -w/-b do seem to produce
oddness. My tests were with whitespace-only changes, in which case
the output is as expected.
> It should behave as if called with regular 'diff -w' (without
> 'hg') as listed in my earlier mail.
You can just use regular diff if you'd like; see the extdiff
extension.
--
[Will Maier]-----------------[willmaier at ml1.net|http://www.lfod.us/]
More information about the Mercurial
mailing list