From 97612f9e99db7c4bda29c0b3aa3d2e77b34de611 Mon Sep 17 00:00:00 2001 From: Martin von Zweigbergk Date: Fri, 22 Oct 2021 21:59:07 -0700 Subject: [PATCH] demos: add demo of the operation log --- README.md | 7 +++++ demos/demo_operation_log.sh | 56 +++++++++++++++++++++++++++++++++++++ 2 files changed, 63 insertions(+) create mode 100755 demos/demo_operation_log.sh diff --git a/README.md b/README.md index feb3cd15e..518dab1d9 100644 --- a/README.md +++ b/README.md @@ -65,6 +65,13 @@ Features: an earlier repo state, or to simply undo a particular operation (which does not necessarily have to be the most recent operation). +
+ Demo + + + +
+ * **Conflicts can be recorded in commits** If an operation results in conflicts, information about those conflicts will diff --git a/demos/demo_operation_log.sh b/demos/demo_operation_log.sh new file mode 100755 index 000000000..71f78a336 --- /dev/null +++ b/demos/demo_operation_log.sh @@ -0,0 +1,56 @@ +#!/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." +run_command "# The \"operation log\" shows the operations so far:" +run_command "jj op log" +sleep 7 +run_command "# We are going to make some changes so we can see how the operation log works." +run_command "# We are currently working off of the \"master\" branch:" +run_command "jj log" +sleep 5 +run_command "# Let'\''s add a file, set a description, and rebase onto the \"test\" branch:" +run_command "echo stuff > new-file" +sleep 2 +run_command "jj describe -m stuff" +sleep 2 +run_command "jj rebase -d test" +sleep 2 +run_command "# We are now going to make another change off of master:" +run_command "jj co master" +sleep 1 +run_command "jj describe -m \"other stuff\"" +sleep 2 +run_command "# The repo now looks like this:" +run_command "jj log" +sleep 5 +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 +sleep 7 +run_command "# Let'\''s undo that rebase operation:" +run_command "jj undo -o $rebase_op" +sleep 3 +run_command "# The \"stuff\" change is now back on master as expected:" +run_command "jj log" +sleep 5 +run_command "# We can also see what the repo looked like after the rebase operation:" +run_command "jj --at-op $rebase_op log" +sleep 5 +run_command "# Looks nice, let'\''s go back to that point:" +run_command "jj op restore -o $rebase_op" +sleep 2 +run_command "# We'\''re now back to before the \"other stuff\" change existed:" +run_command "jj log" +'