diff mercurial/crecord.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 8b6a446508c2
children d2e1dcd4490d
line wrap: on
line diff
--- a/mercurial/crecord.py	Fri Jul 17 02:31:42 2020 -0700
+++ b/mercurial/crecord.py	Fri Jul 17 03:53:19 2020 -0700
@@ -20,6 +20,7 @@
     open,
 )
 from . import (
+    diffhelper,
     encoding,
     error,
     patch as patchmod,
@@ -416,7 +417,7 @@
         contextlen = (
             len(self.before) + len(self.after) + removedconvertedtocontext
         )
-        if self.after and self.after[-1] == b'\\ No newline at end of file\n':
+        if self.after and self.after[-1] == diffhelper.MISSING_NEWLINE_MARKER:
             contextlen -= 1
         fromlen = contextlen + self.removed
         tolen = contextlen + self.added
@@ -503,7 +504,7 @@
         noeol = False
         for line in self.changedlines:
             text = line.linetext
-            if line.linetext == b'\\ No newline at end of file\n':
+            if line.linetext == diffhelper.MISSING_NEWLINE_MARKER:
                 noeol = True
                 break
             if line.applied: