mercurial/diffhelpers.py
changeset 37573 49b82cdb5983
parent 37572 c6b8d614690a
child 37574 a1bcc7ff0eac
--- a/mercurial/diffhelpers.py	Mon Apr 09 20:55:05 2018 +0900
+++ b/mercurial/diffhelpers.py	Mon Apr 09 21:06:46 2018 +0900
@@ -7,6 +7,12 @@
 
 from __future__ import absolute_import
 
+from .i18n import _
+
+from . import (
+    error,
+)
+
 def addlines(fp, hunk, lena, lenb, a, b):
     """Read lines from fp into the hunk
 
@@ -22,6 +28,8 @@
             break
         for i in xrange(num):
             s = fp.readline()
+            if not s:
+                raise error.ParseError(_('incomplete hunk'))
             if s == "\\ No newline at end of file\n":
                 fixnewline(hunk, a, b)
                 continue