merge with stable
authorAugie Fackler <augie@google.com>
Mon, 28 Aug 2017 17:40:03 -0400
changeset 33982 6d9e7145d8d9
parent 33981 5cb0a8fe096e (current diff)
parent 33884 5707bfe04deb (diff)
child 33983 99e3227c83b5
merge with stable
--- a/mercurial/patch.py	Wed Aug 23 18:24:57 2017 +0000
+++ b/mercurial/patch.py	Mon Aug 28 17:40:03 2017 -0400
@@ -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)
--- a/tests/test-revert-interactive.t	Wed Aug 23 18:24:57 2017 +0000
+++ b/tests/test-revert-interactive.t	Mon Aug 28 17:40:03 2017 -0400
@@ -460,3 +460,40 @@
   forget added file newfile (Yn)? y
   $ hg status
   ? newfile
+
+When a line without EOL is selected during "revert -i" (issue5651)
+
+  $ cat <<EOF >> $HGRCPATH
+  > [experimental]
+  > %unset revertalternateinteractivemode
+  > EOF
+
+  $ hg init $TESTTMP/revert-i-eol
+  $ cd $TESTTMP/revert-i-eol
+  $ echo 0 > a
+  $ hg ci -qAm 0
+  $ printf 1 >> a
+  $ hg ci -qAm 1
+  $ cat a
+  0
+  1 (no-eol)
+
+  $ hg revert -ir'.^' <<EOF
+  > y
+  > y
+  > EOF
+  reverting a
+  diff --git a/a b/a
+  1 hunks, 1 lines changed
+  examine changes to 'a'? [Ynesfdaq?] y
+  
+  @@ -1,1 +1,2 @@
+   0
+  +1
+  \ No newline at end of file
+  revert this change to 'a'? [Ynesfdaq?] y
+  
+  $ cat a
+  0
+
+  $ cd ..