Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/patch.py @ 8817:6c9dce20ed70
Fixed patch.eol bug that truncated all patched lines to one character
Also updated the import-eol test to test with lines longer than one character,
and also empty lines.
author | Colin Caughie <c.caughie@indigovision.com> |
---|---|
date | Tue, 16 Jun 2009 16:22:42 +0100 |
parents | ac92775b3b80 |
children | eb7b247a98ea |
comparison
equal
deleted
inserted
replaced
8816:a7c4eb0cc0ed | 8817:6c9dce20ed70 |
---|---|
297 fp = self.opener(fname, 'w') | 297 fp = self.opener(fname, 'w') |
298 try: | 298 try: |
299 if self.eol and self.eol != '\n': | 299 if self.eol and self.eol != '\n': |
300 for l in lines: | 300 for l in lines: |
301 if l and l[-1] == '\n': | 301 if l and l[-1] == '\n': |
302 l = l[:1] + self.eol | 302 l = l[:-1] + self.eol |
303 fp.write(l) | 303 fp.write(l) |
304 else: | 304 else: |
305 fp.writelines(lines) | 305 fp.writelines(lines) |
306 finally: | 306 finally: |
307 fp.close() | 307 fp.close() |