From 9e9b3fba040c0c0ead096bf14f6e82ffe891ef1d Mon Sep 17 00:00:00 2001 From: Ilya Grigoriev Date: Sat, 9 Sep 2023 21:17:47 -0700 Subject: [PATCH] demos: rearrange and reword portions of demos This is mainly to account for the fact that most commands now report more information about the state of the repo. --- demos/demo_git_compat.sh | 1 + demos/demo_juggle_conflicts.sh | 10 ++++------ demos/demo_resolve_conflicts.sh | 15 +++++++-------- demos/demo_working_copy.sh | 22 ++++++++++++---------- demos/helpers.sh | 8 ++++++++ 5 files changed, 32 insertions(+), 24 deletions(-) diff --git a/demos/demo_git_compat.sh b/demos/demo_git_compat.sh index 6b841c88bf..b45e37578b 100755 --- a/demos/demo_git_compat.sh +++ b/demos/demo_git_compat.sh @@ -10,6 +10,7 @@ run_command "cd Hello-World" comment "Inspect it:" run_command "jj log -r 'all()'" +blank run_command "jj diff -r b1" comment "The repo is backed by the actual Git repo:" diff --git a/demos/demo_juggle_conflicts.sh b/demos/demo_juggle_conflicts.sh index b7f423a9cb..9643751632 100755 --- a/demos/demo_juggle_conflicts.sh +++ b/demos/demo_juggle_conflicts.sh @@ -26,13 +26,11 @@ comment "Let's reorder the second and third commits:" run_command "jj rebase -s third -d first" run_command "jj rebase -s second -d third" run_command "jj log" -comment "The commit labeled \"third\" has a conflict, -as expected. What's more interesting is -that the top commit has no conflict! That's -because it has the changes from all three -commits applied to it." +comment "The commit labeled \"third\" has a conflict, as expected. What's more +interesting is that the top commit has no conflict! That's because it +has the changes from all three commits applied to it. -comment "Let's verify that by looking at its contents:" +Let's verify that by looking at its contents:" run_command "jj co second" run_command "cat file" diff --git a/demos/demo_resolve_conflicts.sh b/demos/demo_resolve_conflicts.sh index a83dc646e2..d4f8a3cf50 100755 --- a/demos/demo_resolve_conflicts.sh +++ b/demos/demo_resolve_conflicts.sh @@ -16,21 +16,20 @@ run_command "jj describe -m \"README: say which world\"" run_command "echo \"Hello Earth!\" > README" run_command "jj diff" -comment "We're going to rebase it onto commit b1. +comment "We're going to rebase it onto commit b1b. That commit looks like this:" -run_command "jj diff -r b1" +run_command "jj diff -r b1b" comment "Now rebase:" -run_command "jj rebase -d b1" +run_command "jj rebase -d b1b" -comment "Huh, that seemed to succeed. Let's take a -look at the repo:" +comment "That seemed to succeed but we are also told there is now a conflict. +Let's take a look at the repo:" run_command "jj log -r 'all()'" run_command "jj status" -comment "As you can see, the rebased commit has a -conflict. The file in the working copy looks -like this:" +comment "Indeed, the rebased commit has a conflict. The conflicted file +in the working copy looks like this:" run_command "cat README" comment "Now we will resolve the conflict:" diff --git a/demos/demo_working_copy.sh b/demos/demo_working_copy.sh index e8085c6c78..9c244a7fb9 100755 --- a/demos/demo_working_copy.sh +++ b/demos/demo_working_copy.sh @@ -8,17 +8,16 @@ cd Hello-World comment "We are in the octocat/Hello-World repo. We have an empty working copy on top of master:" -run_command "jj status" run_command "jj log" +run_command "jj status" comment "Now make some changes in the working copy:" run_command "echo \"Goodbye World!\" > README" run_command "echo stuff > new-file" -comment "Our working copy's commit ID changed -because we made changes:" +comment "Because of these changes, our working copy is no longer marked as \"(empty)\". +Also, its commit ID (starting with a blue character) changed:" run_command "jj status" -run_command "jj log" comment "Add a branch so we can easily refer to this commit:" @@ -27,24 +26,27 @@ run_command "jj log" comment "Start working on a new change off of master:" run_command "jj co master" -run_command "jj log" - -comment "Note that the working copy is now clean; the +comment "Note that we were told the working copy is now empty (AKA clean). The \"goodbye\" change stayed in its own commit:" + +run_command "jj log" +comment "Let's do a sanity check: 'jj status' should tell us that +the working copy is clean." run_command "jj status" comment "Modify a file in this new change:" run_command "echo \"Hello everyone!\" > README" +run_command "jj status" comment "The working copy is not special; we can, for example, set the description of any commit. First, set it on the working copy:" -run_command "jj describe -m everyone" +# The output with the description of the working copy messes up the parallel +# a bit, so we redact it. +run_command_output_redacted "jj describe -m everyone" comment "Now set it on the change we worked on before:" run_command "jj describe goodbye -m goodbye" comment "Inspect the result:" run_command "jj log" - -blank diff --git a/demos/helpers.sh b/demos/helpers.sh index cdc2ceeb5e..99a9f09730 100644 --- a/demos/helpers.sh +++ b/demos/helpers.sh @@ -16,6 +16,14 @@ run_command() { COLUMNS=${RUN_COMMAND_COLUMNS-${COLUMNS-80}} eval "$@" } +run_command_output_redacted() { + echo "\$ $@" + # `bash` often resets $COLUMNS, so we also + # allow $RUN_COMMAND_COLUMNS + eval "$@" > /dev/null + echo '... (output redacted) ...' +} + run_command_allow_broken_pipe() { run_command "$@" || { EXITCODE="$?"