--- a/mercurial/mdiff.py Tue Nov 08 17:08:58 2011 +0100
+++ b/mercurial/mdiff.py Wed Nov 09 16:55:59 2011 -0800
@@ -180,8 +180,14 @@
# the file more than once.
lastfunc[0] = astart
- yield "@@ -%d,%d +%d,%d @@%s\n" % (astart + 1, alen,
- bstart + 1, blen, func)
+ # zero-length hunk ranges report their start line as one less
+ if alen:
+ astart += 1
+ if blen:
+ bstart += 1
+
+ yield "@@ -%d,%d +%d,%d @@%s\n" % (astart, alen,
+ bstart, blen, func)
for x in delta:
yield x
for x in xrange(a2, aend):