Mercurial > public > mercurial-scm > hg
comparison mercurial/patch.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 | 2ce60954b1b7 |
children | 7b12a2d2eedc |
comparison
equal
deleted
inserted
replaced
38328:aa9dd805234d | 38329:f47608575c10 |
---|---|
705 eol = '\n' | 705 eol = '\n' |
706 | 706 |
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 |
714 | 714 |
715 self.backend.setfile(fname, ''.join(lines), mode, self.copysource) | 715 self.backend.setfile(fname, ''.join(lines), mode, self.copysource) |