Details
Details
- Reviewers
pulkit - Group Reviewers
hg-reviewers - Commits
- rHG75fd9421440b: crecord: add "x" alias for space, remove test-only "TOGGLE" alias
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 (4 lines) | |||
| M | tests/test-commit-interactive-curses.t (16 lines) |
| Commit | Parents | Author | Summary | Date |
|---|---|---|---|---|
| 9cc04ed9364d | db14b14440c5 | Kyle Lippincott | Jul 8 2019, 3:17 PM |
| crecord allows you to interactively choose among the changes you have made, | crecord allows you to interactively choose among the changes you have made, | ||||
| and confirm only those changes you select for further processing by the command | and confirm only those changes you select for further processing by the command | ||||
| you are running (commit/shelve/revert), after confirming the selected | you are running (commit/shelve/revert), after confirming the selected | ||||
| changes, the unselected changes are still present in your working copy, so you | changes, the unselected changes are still present in your working copy, so you | ||||
| can use crecord multiple times to split large changes into smaller changesets. | can use crecord multiple times to split large changes into smaller changesets. | ||||
| the following are valid keystrokes: | the following are valid keystrokes: | ||||
| [space] : (un-)select item ([~]/[x] = partly/fully applied) | x [space] : (un-)select item ([~]/[x] = partly/fully applied) | ||||
| [enter] : (un-)select item and go to next item of same type | [enter] : (un-)select item and go to next item of same type | ||||
| A : (un-)select all items | A : (un-)select all items | ||||
| up/down-arrow [k/j] : go to previous/next unfolded item | up/down-arrow [k/j] : go to previous/next unfolded item | ||||
| pgup/pgdn [K/J] : go to previous/next item of same type | pgup/pgdn [K/J] : go to previous/next item of same type | ||||
| right/left-arrow [l/h] : go to child item / parent item | right/left-arrow [l/h] : go to child item / parent item | ||||
| shift-left-arrow [H] : go to parent header / fold selected header | shift-left-arrow [H] : go to parent header / fold selected header | ||||
| g : go to the top | g : go to the top | ||||
| G : go to the bottom | G : go to the bottom | ||||
| return True | 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 [' ', 'x']: | ||||
| self.toggleapply() | self.toggleapply() | ||||
| elif keypressed in ['\n', 'KEY_ENTER']: | elif keypressed in ['\n', 'KEY_ENTER']: | ||||
| self.toggleapply() | self.toggleapply() | ||||
| self.nextsametype() | self.nextsametype() | ||||
| elif keypressed in ['A']: | elif keypressed in ['A']: | ||||
| self.toggleall() | self.toggleall() | ||||
| elif keypressed in ['e']: | elif keypressed in ['e']: | ||||
| self.toggleedit(test=test) | self.toggleedit(test=test) | ||||
| $ hg init a | $ hg init a | ||||
| $ 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 | > x | ||||
| > c | > 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 | ||||
| [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 | > x | ||||
| > KEY_DOWN | > KEY_DOWN | ||||
| > c | > 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 | ||||
| $ cat <<EOF >testModeCommands | $ cat <<EOF >testModeCommands | ||||
| > A | > A | ||||
| > KEY_DOWN | > KEY_DOWN | ||||
| > f | > f | ||||
| > KEY_DOWN | > KEY_DOWN | ||||
| > KEY_DOWN | > KEY_DOWN | ||||
| > KEY_DOWN | > KEY_DOWN | ||||
| > KEY_DOWN | > KEY_DOWN | ||||
| > TOGGLE | > x | ||||
| > a | > a | ||||
| > a | > a | ||||
| > e | > e | ||||
| > c | > 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 | ||||
| Newly added files can be selected with the curses interface | Newly added files can be selected with the curses interface | ||||
| $ 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 | > x | ||||
| > TOGGLE | > x | ||||
| > c | > 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 | ||||
| $ 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 | > x | ||||
| > c | > 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 | ||||
| $ cat > editor.sh <<EOF | $ cat > editor.sh <<EOF | ||||
| > cat "\$1" | > cat "\$1" | ||||
| > cat "\$1" | sed s/bottom/lower/ > tmp | > cat "\$1" | sed s/bottom/lower/ > tmp | ||||
| > mv tmp "\$1" | > mv tmp "\$1" | ||||
| > EOF | > EOF | ||||
| $ cat > testModeCommands <<EOF | $ cat > testModeCommands <<EOF | ||||
| > KEY_DOWN | > KEY_DOWN | ||||
| > TOGGLE | > x | ||||
| > KEY_DOWN | > KEY_DOWN | ||||
| > f | > f | ||||
| > KEY_DOWN | > KEY_DOWN | ||||
| > TOGGLE | > x | ||||
| > R | > R | ||||
| > EOF | > EOF | ||||
| $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg commit -i -m "review hunks" -d "0 0" | $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg commit -i -m "review hunks" -d "0 0" | ||||
| # To remove '-' lines, make them ' ' lines (context). | # To remove '-' lines, make them ' ' lines (context). | ||||
| # To remove '+' lines, delete them. | # To remove '+' lines, delete them. | ||||
| # Lines starting with # will be removed from the patch. | # Lines starting with # will be removed from the patch. | ||||
| # | # | ||||