Mercurial > hg-stable
comparison 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 |
comparison
equal
deleted
inserted
replaced
27155:8d3c5797a175 | 27156:55fa7c3900ae |
---|---|
69 | 69 |
70 - Untoggle all the hunks, go down to the second file | 70 - Untoggle all the hunks, go down to the second file |
71 - unfold it | 71 - unfold it |
72 - 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) | 72 - 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) |
73 - toggle the second hunk | 73 - toggle the second hunk |
74 - toggle on and off the amend mode (to check that it toggles off) | |
74 - edit the hunk and quit the editor immediately with non-zero status | 75 - edit the hunk and quit the editor immediately with non-zero status |
75 - commit | 76 - commit |
76 | 77 |
77 $ printf "printf 'editor ran\n'; exit 1" > editor.sh | 78 $ printf "printf 'editor ran\n'; exit 1" > editor.sh |
78 $ echo "x" > c | 79 $ echo "x" > c |
86 > KEY_DOWN | 87 > KEY_DOWN |
87 > KEY_DOWN | 88 > KEY_DOWN |
88 > KEY_DOWN | 89 > KEY_DOWN |
89 > KEY_DOWN | 90 > KEY_DOWN |
90 > TOGGLE | 91 > TOGGLE |
92 > a | |
93 > a | |
91 > e | 94 > e |
92 > X | 95 > X |
93 > EOF | 96 > EOF |
94 $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg commit -i -m "one hunk" -d "0 0" | 97 $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg commit -i -m "one hunk" -d "0 0" |
95 editor ran | 98 editor ran |
164 ? testModeCommands | 167 ? testModeCommands |
165 $ hg commit -i -m "newly added file" -d "0 0" | 168 $ hg commit -i -m "newly added file" -d "0 0" |
166 $ hg st | 169 $ hg st |
167 ? testModeCommands | 170 ? testModeCommands |
168 | 171 |
172 Amend option works | |
173 $ echo "hello world" > x | |
174 $ hg diff -c . | |
175 diff -r a6735021574d -r 2b0e9be4d336 x | |
176 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 | |
177 +++ b/x Thu Jan 01 00:00:00 1970 +0000 | |
178 @@ -0,0 +1,1 @@ | |
179 +hello | |
180 $ cat <<EOF >testModeCommands | |
181 > a | |
182 > X | |
183 > EOF | |
184 $ hg commit -i -m "newly added file" -d "0 0" | |
185 saved backup bundle to $TESTTMP/a/.hg/strip-backup/2b0e9be4d336-28bbe4e2-amend-backup.hg (glob) | |
186 $ hg diff -c . | |
187 diff -r a6735021574d -r c1d239d165ae x | |
188 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 | |
189 +++ b/x Thu Jan 01 00:00:00 1970 +0000 | |
190 @@ -0,0 +1,1 @@ | |
191 +hello world |