diff tests/test-revert-interactive.t @ 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 51fdedd29b0a
children 3649c3f2cd90
line wrap: on
line diff
--- a/tests/test-revert-interactive.t	Tue Aug 15 23:23:55 2017 -0700
+++ b/tests/test-revert-interactive.t	Sun Aug 27 13:39:17 2017 -0700
@@ -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 ..