mercurial/mdiff.py
changeset 15471 f520c9616db5
parent 15437 8f08b635cdce
parent 15462 2b1ec74c961f
child 15513 646759147717
--- a/mercurial/mdiff.py	Thu Nov 10 10:59:03 2011 -0600
+++ b/mercurial/mdiff.py	Thu Nov 10 11:00:27 2011 -0600
@@ -183,8 +183,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):