I am wondering how to improve the diff command as part of hg. For example, lets say I have this code:
line 1
line 2
lin3 3
and I change it to become:
if($condition) {
line 1
line 2
line 3
}
hg diff will show the original three lines with a "-" and the new five lines with a "+". Even when I run with -wbB to ignore whitespace and line changes. I understand what it is trying to tell me, but isn't there way it could be "smarter" and realize that I've only added two lines (and increased level of three lines)?
EDIT: Is it possible to have hg diff tell you what text was added and where? As opposed to how the "structure" of the code changed because of those additions?
EDIT 2: I am running Debian (Linux dev 2.6.26) with Mercurial 1.0.1
Thanks
You're seeing those changes because whitespace changes count. If you do hg diff --ignore-space-change
you'll see something more like:
+ if($condition) {
line 1
line 2
line 3
+ }
which sound like what you want. You can also use the ExtDiff Extension to call any of the alternate diff programs @sarnold suggests.
Also, consider updating Mercurial. Your version is about three years old and current packages are built for Debian.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With