##// END OF EJS Templates
py3: replace s[-1] with s.endswith() in eol handling
Yuya Nishihara -
r38351:f4760857 default
parent child Browse files
Show More
@@ -123,6 +123,7 b' test-encoding.t'
123 test-eol-add.t
123 test-eol-add.t
124 test-eol-clone.t
124 test-eol-clone.t
125 test-eol-hook.t
125 test-eol-hook.t
126 test-eol-patch.t
126 test-eol-tag.t
127 test-eol-tag.t
127 test-eol-update.t
128 test-eol-update.t
128 test-excessive-merge.t
129 test-excessive-merge.t
@@ -199,6 +200,7 b' test-http-clone-r.t'
199 test-http.t
200 test-http.t
200 test-hybridencode.py
201 test-hybridencode.py
201 test-identify.t
202 test-identify.t
203 test-import-bypass.t
202 test-import-merge.t
204 test-import-merge.t
203 test-import-unknown.t
205 test-import-unknown.t
204 test-import.t
206 test-import.t
@@ -142,7 +142,7 b' def tolf(s, params, ui, **kwargs):'
142 if ui.configbool('eol', 'only-consistent') and inconsistenteol(s):
142 if ui.configbool('eol', 'only-consistent') and inconsistenteol(s):
143 return s
143 return s
144 if (ui.configbool('eol', 'fix-trailing-newline')
144 if (ui.configbool('eol', 'fix-trailing-newline')
145 and s and s[-1] != '\n'):
145 and s and not s.endswith('\n')):
146 s = s + '\n'
146 s = s + '\n'
147 return util.tolf(s)
147 return util.tolf(s)
148
148
@@ -153,7 +153,7 b' def tocrlf(s, params, ui, **kwargs):'
153 if ui.configbool('eol', 'only-consistent') and inconsistenteol(s):
153 if ui.configbool('eol', 'only-consistent') and inconsistenteol(s):
154 return s
154 return s
155 if (ui.configbool('eol', 'fix-trailing-newline')
155 if (ui.configbool('eol', 'fix-trailing-newline')
156 and s and s[-1] != '\n'):
156 and s and not s.endswith('\n')):
157 s = s + '\n'
157 s = s + '\n'
158 return util.tocrlf(s)
158 return util.tocrlf(s)
159
159
@@ -707,7 +707,7 b' class patchfile(object):'
707 if self.eolmode != 'strict' and eol and eol != '\n':
707 if self.eolmode != 'strict' and eol and eol != '\n':
708 rawlines = []
708 rawlines = []
709 for l in lines:
709 for l in lines:
710 if l and l[-1] == '\n':
710 if l and l.endswith('\n'):
711 l = l[:-1] + eol
711 l = l[:-1] + eol
712 rawlines.append(l)
712 rawlines.append(l)
713 lines = rawlines
713 lines = rawlines
General Comments 0
You need to be logged in to leave comments. Login now