diff mercurial/diffhelper.py @ 45154:10f48720ef95

diff: move no-eol text constant to a common location Differential Revision: https://phab.mercurial-scm.org/D8763
author Rodrigo Damazio Bovendorp <rdamazio@google.com>
date Fri, 17 Jul 2020 03:53:19 -0700
parents 687b865b95ad
children d4ba4d51f85f
line wrap: on
line diff
--- a/mercurial/diffhelper.py	Fri Jul 17 02:31:42 2020 -0700
+++ b/mercurial/diffhelper.py	Fri Jul 17 03:53:19 2020 -0700
@@ -14,6 +14,8 @@
     pycompat,
 )
 
+MISSING_NEWLINE_MARKER = b'\\ No newline at end of file\n'
+
 
 def addlines(fp, hunk, lena, lenb, a, b):
     """Read lines from fp into the hunk
@@ -32,7 +34,7 @@
             s = fp.readline()
             if not s:
                 raise error.ParseError(_(b'incomplete hunk'))
-            if s == b"\\ No newline at end of file\n":
+            if s == MISSING_NEWLINE_MARKER:
                 fixnewline(hunk, a, b)
                 continue
             if s == b'\n' or s == b'\r\n':