diff tests/test-commit-interactive-curses.t @ 27156:55fa7c3900ae

commit: add amend mode for commit -i When I moved crecord into core, I didn't include the toggleAmend function (to switch from commit to amend mode). I did it because it would have made it more difficult to use record and crecord interchangably. This patch reintroduces the amend mode for commit -i as well as two tests to verify the behavior of the function.
author Laurent Charignon <lcharignon@fb.com>
date Mon, 30 Nov 2015 16:37:42 -0800
parents 1aee2ab0f902
children dcdf0a52ad36
line wrap: on
line diff
--- a/tests/test-commit-interactive-curses.t	Mon Nov 30 16:35:21 2015 -0800
+++ b/tests/test-commit-interactive-curses.t	Mon Nov 30 16:37:42 2015 -0800
@@ -71,6 +71,7 @@
 - unfold it
 - go down to second hunk (1 for the first hunk, 1 for the first hunkline, 1 for the second hunk, 1 for the second hunklike)
 - toggle the second hunk
+- toggle on and off the amend mode (to check that it toggles off)
 - edit the hunk and quit the editor immediately with non-zero status
 - commit
 
@@ -88,6 +89,8 @@
   > KEY_DOWN
   > KEY_DOWN
   > TOGGLE
+  > a
+  > a
   > e
   > X
   > EOF
@@ -166,3 +169,23 @@
   $ hg st
   ? testModeCommands
 
+Amend option works
+  $ echo "hello world" > x
+  $ hg diff -c .
+  diff -r a6735021574d -r 2b0e9be4d336 x
+  --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+  +++ b/x	Thu Jan 01 00:00:00 1970 +0000
+  @@ -0,0 +1,1 @@
+  +hello
+  $ cat <<EOF >testModeCommands
+  > a
+  > X
+  > EOF
+  $ hg commit -i  -m "newly added file" -d "0 0"
+  saved backup bundle to $TESTTMP/a/.hg/strip-backup/2b0e9be4d336-28bbe4e2-amend-backup.hg (glob)
+  $ hg diff -c .
+  diff -r a6735021574d -r c1d239d165ae x
+  --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+  +++ b/x	Thu Jan 01 00:00:00 1970 +0000
+  @@ -0,0 +1,1 @@
+  +hello world