Mercurial > hg
diff hgext/eol.py @ 38329:f47608575c10
py3: replace s[-1] with s.endswith() in eol handling
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Sat, 16 Jun 2018 17:53:51 +0900 |
parents | 5f8f013e7d52 |
children | e7aa113b14f7 |
line wrap: on
line diff
--- 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)