2021-10-23 04:59:07 +00:00
|
|
|
#!/bin/bash
|
|
|
|
set -euo pipefail
|
|
|
|
. "$(dirname "$0")"/demo_helpers.sh
|
|
|
|
parse_args "$@"
|
|
|
|
|
|
|
|
new_tmp_dir
|
|
|
|
jj git clone https://github.com/octocat/Hello-World
|
|
|
|
cd Hello-World
|
|
|
|
|
|
|
|
run_demo 'The entire repo is under version control' '
|
|
|
|
run_command "# We are in the octocat/Hello-World repo."
|
2021-10-27 22:07:46 +00:00
|
|
|
run_command "# The \"operation log\" shows the operations"
|
|
|
|
run_command "# so far:"
|
2021-10-23 04:59:07 +00:00
|
|
|
run_command "jj op log"
|
2021-10-23 16:34:58 +00:00
|
|
|
pause 7
|
2021-10-27 22:07:46 +00:00
|
|
|
run_command "# We are going to make some changes to show"
|
|
|
|
run_command "# how the operation log works."
|
|
|
|
run_command "# We are currently working off of the \"master\""
|
|
|
|
run_command "# branch:"
|
2021-10-23 04:59:07 +00:00
|
|
|
run_command "jj log"
|
2021-10-23 16:34:58 +00:00
|
|
|
pause 5
|
2021-10-27 22:07:46 +00:00
|
|
|
run_command "# Let'\''s add a file, set a description, and"
|
|
|
|
run_command "# rebase onto the \"test\" branch:"
|
2021-10-23 04:59:07 +00:00
|
|
|
run_command "echo stuff > new-file"
|
2021-10-23 16:34:58 +00:00
|
|
|
pause 2
|
2021-10-23 04:59:07 +00:00
|
|
|
run_command "jj describe -m stuff"
|
2021-10-23 16:34:58 +00:00
|
|
|
pause 2
|
2021-10-23 04:59:07 +00:00
|
|
|
run_command "jj rebase -d test"
|
2021-10-23 16:34:58 +00:00
|
|
|
pause 2
|
2021-10-27 23:35:48 +00:00
|
|
|
run_command ""
|
2021-10-27 22:07:46 +00:00
|
|
|
run_command "# We are now going to make another change off of"
|
|
|
|
run_command "# master:"
|
2021-10-23 04:59:07 +00:00
|
|
|
run_command "jj co master"
|
2021-10-23 16:34:58 +00:00
|
|
|
pause 1
|
2021-10-23 04:59:07 +00:00
|
|
|
run_command "jj describe -m \"other stuff\""
|
2021-10-23 16:34:58 +00:00
|
|
|
pause 2
|
2021-10-23 04:59:07 +00:00
|
|
|
run_command "# The repo now looks like this:"
|
|
|
|
run_command "jj log"
|
2021-10-23 16:34:58 +00:00
|
|
|
pause 5
|
2021-10-23 04:59:07 +00:00
|
|
|
run_command "# And the operation log looks like this:"
|
|
|
|
send -h "jj op log\r"
|
|
|
|
# Capture the third latest operation id (skipping color codes around it)
|
|
|
|
expect -re "o ..34m(.*?)..0m "
|
|
|
|
expect -re "o ..34m(.*?)..0m "
|
|
|
|
set rebase_op $expect_out(1,string)
|
|
|
|
expect_prompt
|
2021-10-23 16:34:58 +00:00
|
|
|
pause 7
|
2021-10-27 23:35:48 +00:00
|
|
|
run_command ""
|
2021-10-23 04:59:07 +00:00
|
|
|
run_command "# Let'\''s undo that rebase operation:"
|
|
|
|
run_command "jj undo -o $rebase_op"
|
2021-10-23 16:34:58 +00:00
|
|
|
pause 3
|
2021-10-27 22:07:46 +00:00
|
|
|
run_command "# The \"stuff\" change is now back on master as"
|
|
|
|
run_command "# expected:"
|
2021-10-23 04:59:07 +00:00
|
|
|
run_command "jj log"
|
2021-10-23 16:34:58 +00:00
|
|
|
pause 5
|
2021-10-27 22:07:46 +00:00
|
|
|
run_command "# We can also see what the repo looked like"
|
|
|
|
run_command "# after the rebase operation:"
|
2021-10-23 04:59:07 +00:00
|
|
|
run_command "jj --at-op $rebase_op log"
|
2021-10-23 16:34:58 +00:00
|
|
|
pause 5
|
2021-10-23 04:59:07 +00:00
|
|
|
run_command "# Looks nice, let'\''s go back to that point:"
|
|
|
|
run_command "jj op restore -o $rebase_op"
|
2021-10-23 16:34:58 +00:00
|
|
|
pause 2
|
2021-10-27 23:35:48 +00:00
|
|
|
run_command ""
|
2021-10-27 22:07:46 +00:00
|
|
|
run_command "# We'\''re now back to before the \"other stuff\""
|
|
|
|
run_command "# change existed:"
|
2021-10-23 04:59:07 +00:00
|
|
|
run_command "jj log"
|
|
|
|
'
|