Bug in 'hg diff'

Guido Ostkamp hg at ostkamp.fastmail.fm
Tue Jul 24 14:19:06 CDT 2007


Hello,

> 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?

I indeed wanted to use '-w', but results were incorrect, so I tried '-b' 
next. Also, as already said, the help text is confusing.

> 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.

Correct. I did indeed add a fourth line in my example. In combination with 
this, the result went bad, but I had not noticed the dependency yet.

Anyway the result is not as expected and the output is unusable for me.

I pretty often run into situations where I have to fix bad style code 
indentations caused by people blindly using a mixture of spaces and tabs 
as line prefix instead of either a number of pure spaces or pure tabs.

When I fix this, I always end up with a lot of changes (mostly 
automatically generated by vim or indent), however nothing has really 
changed from compilers point of view. This can usually be verified using 
the '-w' switch of the regular diff and of course I expected the same 
kind of output here.

>> 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.

I wonder what the 'hg diff' options are good for when they don't work as 
expected. Is this output needed for automatic treatment? I doubt this 
could be used in conjunction with partially ignoring whitespace changes.

By the way: GIT does not seem to have this kind of problem:

$ git diff -w testfile
diff --git a/testfile b/testfile
index 53a7986..ddd9b80 100644
--- a/testfile
+++ b/testfile
@@ -1,3 +1,4 @@
  This is a test.
  This is another test.
  This is a third test.
+blabla

This is what I had expected as output from 'hg diff -w' as well.

Regards

Guido


More information about the Mercurial mailing list