mercurial/mdiff.py
branchstable
changeset 15462 2b1ec74c961f
parent 15141 16dc9a32ca04
child 15471 f520c9616db5
child 15509 3774e1453ef4
--- 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):