14

Are there any plans to make whitespace-insensitive diffs (diff --ignore-space-change and diff --ignore-all-space) available? A lot of code reviews we do are essentially impossible unless whitespace-insensitive diffs (diff -b or diff -w) are available due to re-indenting and automatic newline normalization.

flag

closed as no longer relevant by Benjamin Pollack♦♦ Feb 22 2011 at 15:55

6 Answers

4

Hi nohat,

I'm opening a feature request for this, but we won't be able to squeeze it into the 1.0 release.

If other users have need for a similar setting, please chime in.

EDIT: Implemented in Kiln 2.4.

link|flag
3

While we don't have a way to do that right now, two things might help you regardless.

First, if your developers are routinely massively reformatting huge tracts of code, you should probably consider imposing some coding standards. Even when we add whitespace-ignoring diffs, changing lines that don't need to be changed makes hg annotate more-or-less useless, which can make it nearly impossible to figure out when and why a given line was changed. You can even use Mercurial's commit hooks to help your developers only commit properly formatted code.

Second, if the main problem is in fact merely line endings, Mercurial comes with an extension called win32text which will normalize all line endings for you on commit, allowing Windows users to have \r\n, Unix and OS X users to have \n, and that lone crazy dude you're never going to make leave his PowerMac 8600 and PowerMops to have \r. Consult the full instructions for enabling win32text if you're interested. Not only will this help your diffs be less cluttered; you'll get hg annotate's awesomeness back, too.

link|flag
1

+1 for this request.

Reformatting files via the pre-commit hook mechanism could work well, but the thought of the code that's checked in being subtly different to the code that been tested does worry me a little....

link|flag
1

I'd love to see this too.

link|flag
0

I also love to see this. Code review is very hard without this feature... With such a mature and good product it bad to not have this feature :(

link|flag
0

As of Kiln 2.4, you can enable whitespace insensitive diffs, equivalent to hg diff -w.

link|flag

Not the answer you're looking for? Browse other questions tagged or ask your own question.