Mercurial > public > mercurial-scm > hg
comparison mercurial/patch.py @ 33884:5707bfe04deb stable
record: fix revert -i for lines without newline (issue5651)
This is a regression caused by 66117dae87f9. Code prior to 66117dae87f9
seems to miss the "\ No newline at end of file" line.
Differential Revision: https://phab.mercurial-scm.org/D528
author | Jun Wu <quark@fb.com> |
---|---|
date | Sun, 27 Aug 2017 13:39:17 -0700 |
parents | ea8c2478c907 |
children | da07367d683b |
comparison
equal
deleted
inserted
replaced
33862:fb672eac2702 | 33884:5707bfe04deb |
---|---|
970 | 970 |
971 If this hunk is diff(A, B), the returned hunk is diff(B, A). To do | 971 If this hunk is diff(A, B), the returned hunk is diff(B, A). To do |
972 that, swap fromline/toline and +/- signs while keep other things | 972 that, swap fromline/toline and +/- signs while keep other things |
973 unchanged. | 973 unchanged. |
974 """ | 974 """ |
975 m = {'+': '-', '-': '+'} | 975 m = {'+': '-', '-': '+', '\\': '\\'} |
976 hunk = ['%s%s' % (m[l[0]], l[1:]) for l in self.hunk] | 976 hunk = ['%s%s' % (m[l[0]], l[1:]) for l in self.hunk] |
977 return recordhunk(self.header, self.toline, self.fromline, self.proc, | 977 return recordhunk(self.header, self.toline, self.fromline, self.proc, |
978 self.before, hunk, self.after) | 978 self.before, hunk, self.after) |
979 | 979 |
980 def write(self, fp): | 980 def write(self, fp): |