Details
Details
- Reviewers
pulkit - Group Reviewers
hg-reviewers - Commits
- rHG756326d54761: crecord: stop using test-only "X" as alternative for "c"
Diff Detail
Diff Detail
- Repository
- rHG Mercurial
- Lint
Lint Skipped - Unit
Unit Tests Skipped
( )
pulkit |
hg-reviewers |
Lint Skipped |
Unit Tests Skipped |
Path | Packages | |||
---|---|---|---|---|
M | mercurial/crecord.py (2 lines) | |||
M | tests/test-commit-interactive-curses.t (16 lines) |
Commit | Parents | Author | Summary | Date |
---|---|---|---|---|
db14b14440c5 | 44e99811bea7 | Kyle Lippincott | Jul 8 2019, 3:15 PM |
elif keypressed in ["H", "KEY_SLEFT"]: | elif keypressed in ["H", "KEY_SLEFT"]: | ||||
self.leftarrowshiftevent() | self.leftarrowshiftevent() | ||||
elif keypressed in ["q"]: | elif keypressed in ["q"]: | ||||
raise error.Abort(_('user quit')) | raise error.Abort(_('user quit')) | ||||
elif keypressed in ['a']: | elif keypressed in ['a']: | ||||
self.toggleamend(self.opts, test) | self.toggleamend(self.opts, test) | ||||
elif keypressed in ["c"]: | elif keypressed in ["c"]: | ||||
return True | return True | ||||
elif test and keypressed in ['X']: | |||||
return True | |||||
elif keypressed in ["r"]: | elif keypressed in ["r"]: | ||||
if self.reviewcommit(): | if self.reviewcommit(): | ||||
self.opts['review'] = True | self.opts['review'] = True | ||||
return True | return True | ||||
elif test and keypressed in ['R']: | elif test and keypressed in ['R']: | ||||
self.opts['review'] = True | self.opts['review'] = True | ||||
return True | return True | ||||
elif keypressed in [' '] or (test and keypressed in ["TOGGLE"]): | elif keypressed in [' '] or (test and keypressed in ["TOGGLE"]): |
$ cd a | $ cd a | ||||
Committing some changes but stopping on the way | Committing some changes but stopping on the way | ||||
$ echo "a" > a | $ echo "a" > a | ||||
$ hg add a | $ hg add a | ||||
$ cat <<EOF >testModeCommands | $ cat <<EOF >testModeCommands | ||||
> TOGGLE | > TOGGLE | ||||
> X | > c | ||||
> EOF | > EOF | ||||
$ hg commit -i -m "a" -d "0 0" | $ hg commit -i -m "a" -d "0 0" | ||||
no changes to record | no changes to record | ||||
[1] | [1] | ||||
$ hg tip | $ hg tip | ||||
changeset: -1:000000000000 | changeset: -1:000000000000 | ||||
tag: tip | tag: tip | ||||
user: | user: | ||||
date: Thu Jan 01 00:00:00 1970 +0000 | date: Thu Jan 01 00:00:00 1970 +0000 | ||||
Committing some changes | Committing some changes | ||||
$ cat <<EOF >testModeCommands | $ cat <<EOF >testModeCommands | ||||
> X | > c | ||||
> EOF | > EOF | ||||
$ hg commit -i -m "a" -d "0 0" | $ hg commit -i -m "a" -d "0 0" | ||||
$ hg tip | $ hg tip | ||||
changeset: 0:cb9a9f314b8b | changeset: 0:cb9a9f314b8b | ||||
tag: tip | tag: tip | ||||
user: test | user: test | ||||
date: Thu Jan 01 00:00:00 1970 +0000 | date: Thu Jan 01 00:00:00 1970 +0000 | ||||
summary: a | summary: a | ||||
Check that commit -i works with no changes | Check that commit -i works with no changes | ||||
$ hg commit -i | $ hg commit -i | ||||
no changes to record | no changes to record | ||||
[1] | [1] | ||||
Committing only one file | Committing only one file | ||||
$ echo "a" >> a | $ echo "a" >> a | ||||
>>> open('b', 'wb').write(b"1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n") and None | >>> open('b', 'wb').write(b"1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n") and None | ||||
$ hg add b | $ hg add b | ||||
$ cat <<EOF >testModeCommands | $ cat <<EOF >testModeCommands | ||||
> TOGGLE | > TOGGLE | ||||
> KEY_DOWN | > KEY_DOWN | ||||
> X | > c | ||||
> EOF | > EOF | ||||
$ hg commit -i -m "one file" -d "0 0" | $ hg commit -i -m "one file" -d "0 0" | ||||
$ hg tip | $ hg tip | ||||
changeset: 1:fb2705a663ea | changeset: 1:fb2705a663ea | ||||
tag: tip | tag: tip | ||||
user: test | user: test | ||||
date: Thu Jan 01 00:00:00 1970 +0000 | date: Thu Jan 01 00:00:00 1970 +0000 | ||||
summary: one file | summary: one file | ||||
> KEY_DOWN | > KEY_DOWN | ||||
> KEY_DOWN | > KEY_DOWN | ||||
> KEY_DOWN | > KEY_DOWN | ||||
> KEY_DOWN | > KEY_DOWN | ||||
> TOGGLE | > TOGGLE | ||||
> a | > a | ||||
> a | > a | ||||
> e | > e | ||||
> X | > c | ||||
> EOF | > EOF | ||||
$ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg commit -i -m "one hunk" -d "0 0" | $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg commit -i -m "one hunk" -d "0 0" | ||||
editor ran | editor ran | ||||
$ rm editor.sh | $ rm editor.sh | ||||
$ hg tip | $ hg tip | ||||
changeset: 2:7d10dfe755a8 | changeset: 2:7d10dfe755a8 | ||||
tag: tip | tag: tip | ||||
user: test | user: test | ||||
$ hg update -C . | $ hg update -C . | ||||
0 files updated, 0 files merged, 0 files removed, 0 files unresolved | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved | ||||
$ echo "hello" > x | $ echo "hello" > x | ||||
$ hg add x | $ hg add x | ||||
$ cat <<EOF >testModeCommands | $ cat <<EOF >testModeCommands | ||||
> TOGGLE | > TOGGLE | ||||
> TOGGLE | > TOGGLE | ||||
> X | > c | ||||
> EOF | > EOF | ||||
$ hg st | $ hg st | ||||
A x | A x | ||||
? testModeCommands | ? testModeCommands | ||||
$ hg commit -i -m "newly added file" -d "0 0" | $ hg commit -i -m "newly added file" -d "0 0" | ||||
$ hg st | $ hg st | ||||
? testModeCommands | ? testModeCommands | ||||
Amend option works | Amend option works | ||||
$ echo "hello world" > x | $ echo "hello world" > x | ||||
$ hg diff -c . | $ hg diff -c . | ||||
diff -r a6735021574d -r 2b0e9be4d336 x | diff -r a6735021574d -r 2b0e9be4d336 x | ||||
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 | --- /dev/null Thu Jan 01 00:00:00 1970 +0000 | ||||
+++ b/x Thu Jan 01 00:00:00 1970 +0000 | +++ b/x Thu Jan 01 00:00:00 1970 +0000 | ||||
@@ -0,0 +1,1 @@ | @@ -0,0 +1,1 @@ | ||||
+hello | +hello | ||||
$ cat <<EOF >testModeCommands | $ cat <<EOF >testModeCommands | ||||
> a | > a | ||||
> X | > c | ||||
> EOF | > EOF | ||||
$ hg commit -i -m "newly added file" -d "0 0" | $ hg commit -i -m "newly added file" -d "0 0" | ||||
saved backup bundle to $TESTTMP/a/.hg/strip-backup/2b0e9be4d336-3cf0bc8c-amend.hg | saved backup bundle to $TESTTMP/a/.hg/strip-backup/2b0e9be4d336-3cf0bc8c-amend.hg | ||||
$ hg diff -c . | $ hg diff -c . | ||||
diff -r a6735021574d -r c1d239d165ae x | diff -r a6735021574d -r c1d239d165ae x | ||||
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 | --- /dev/null Thu Jan 01 00:00:00 1970 +0000 | ||||
+++ b/x Thu Jan 01 00:00:00 1970 +0000 | +++ b/x Thu Jan 01 00:00:00 1970 +0000 | ||||
@@ -0,0 +1,1 @@ | @@ -0,0 +1,1 @@ | ||||
+hello world | +hello world | ||||
Make file empty | Make file empty | ||||
$ printf "" > x | $ printf "" > x | ||||
$ cat <<EOF >testModeCommands | $ cat <<EOF >testModeCommands | ||||
> X | > c | ||||
> EOF | > EOF | ||||
$ hg ci -i -m emptify -d "0 0" | $ hg ci -i -m emptify -d "0 0" | ||||
$ hg update -C '.^' -q | $ hg update -C '.^' -q | ||||
Editing a hunk puts you back on that hunk when done editing (issue5041) | Editing a hunk puts you back on that hunk when done editing (issue5041) | ||||
To do that, we change two lines in a file, pretend to edit the second line, | To do that, we change two lines in a file, pretend to edit the second line, | ||||
exit, toggle the line selected at the end of the edit and commit. | exit, toggle the line selected at the end of the edit and commit. | ||||
The first line should be recorded if we were put on the second line at the end | The first line should be recorded if we were put on the second line at the end | ||||
of the edit. | of the edit. | ||||
$ hg update -C . | $ hg update -C . | ||||
0 files updated, 0 files merged, 0 files removed, 0 files unresolved | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved | ||||
$ echo "foo" > x | $ echo "foo" > x | ||||
$ echo "hello world" >> x | $ echo "hello world" >> x | ||||
$ echo "bar" >> x | $ echo "bar" >> x | ||||
$ cat <<EOF >testModeCommands | $ cat <<EOF >testModeCommands | ||||
> f | > f | ||||
> KEY_DOWN | > KEY_DOWN | ||||
> KEY_DOWN | > KEY_DOWN | ||||
> KEY_DOWN | > KEY_DOWN | ||||
> KEY_DOWN | > KEY_DOWN | ||||
> e | > e | ||||
> TOGGLE | > TOGGLE | ||||
> X | > c | ||||
> EOF | > EOF | ||||
$ printf "printf 'editor ran\n'; exit 0" > editor.sh | $ printf "printf 'editor ran\n'; exit 0" > editor.sh | ||||
$ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg commit -i -m "edit hunk" -d "0 0" -q | $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg commit -i -m "edit hunk" -d "0 0" -q | ||||
editor ran | editor ran | ||||
$ hg cat -r . x | $ hg cat -r . x | ||||
foo | foo | ||||
hello world | hello world | ||||