hgext/eol.py
changeset 38329 f47608575c10
parent 37678 5f8f013e7d52
child 38783 e7aa113b14f7
--- a/hgext/eol.py	Sat Jun 16 17:36:44 2018 +0900
+++ b/hgext/eol.py	Sat Jun 16 17:53:51 2018 +0900
@@ -142,7 +142,7 @@
     if ui.configbool('eol', 'only-consistent') and inconsistenteol(s):
         return s
     if (ui.configbool('eol', 'fix-trailing-newline')
-        and s and s[-1] != '\n'):
+        and s and not s.endswith('\n')):
         s = s + '\n'
     return util.tolf(s)
 
@@ -153,7 +153,7 @@
     if ui.configbool('eol', 'only-consistent') and inconsistenteol(s):
         return s
     if (ui.configbool('eol', 'fix-trailing-newline')
-        and s and s[-1] != '\n'):
+        and s and not s.endswith('\n')):
         s = s + '\n'
     return util.tocrlf(s)