diff 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
line wrap: on
line diff
--- a/mercurial/patch.py	Tue Aug 15 23:23:55 2017 -0700
+++ b/mercurial/patch.py	Sun Aug 27 13:39:17 2017 -0700
@@ -972,7 +972,7 @@
         that, swap fromline/toline and +/- signs while keep other things
         unchanged.
         """
-        m = {'+': '-', '-': '+'}
+        m = {'+': '-', '-': '+', '\\': '\\'}
         hunk = ['%s%s' % (m[l[0]], l[1:]) for l in self.hunk]
         return recordhunk(self.header, self.toline, self.fromline, self.proc,
                           self.before, hunk, self.after)