# HG changeset patch # User Yuya Nishihara <y...@tcha.org> # Date 1529139231 -32400 # Sat Jun 16 17:53:51 2018 +0900 # Node ID bb0ed8255ed912ae146dd3f1f594ab3321025f48 # Parent cfa1ca8c0eb7a92cdc088b0699415f9d4351543a py3: replace s[-1] with s.endswith() in eol handling
diff --git a/contrib/python3-whitelist b/contrib/python3-whitelist --- a/contrib/python3-whitelist +++ b/contrib/python3-whitelist @@ -123,6 +123,7 @@ test-encoding.t test-eol-add.t test-eol-clone.t test-eol-hook.t +test-eol-patch.t test-eol-tag.t test-eol-update.t test-excessive-merge.t @@ -199,6 +200,7 @@ test-http-clone-r.t test-http.t test-hybridencode.py test-identify.t +test-import-bypass.t test-import-merge.t test-import-unknown.t test-import.t diff --git a/hgext/eol.py b/hgext/eol.py --- a/hgext/eol.py +++ b/hgext/eol.py @@ -142,7 +142,7 @@ def tolf(s, params, ui, **kwargs): 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 @@ def tocrlf(s, params, ui, **kwargs): 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) diff --git a/mercurial/patch.py b/mercurial/patch.py --- a/mercurial/patch.py +++ b/mercurial/patch.py @@ -707,7 +707,7 @@ class patchfile(object): if self.eolmode != 'strict' and eol and eol != '\n': rawlines = [] for l in lines: - if l and l[-1] == '\n': + if l and l.endswith('\n'): l = l[:-1] + eol rawlines.append(l) lines = rawlines _______________________________________________ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel