Skip to content

Commit

Permalink
demos: rearrange and reword portions of demos
Browse files Browse the repository at this point in the history
This is mainly to account for the fact that most commands now report
more information about the state of the repo.
  • Loading branch information
ilyagr committed Sep 17, 2023
1 parent 6b8c03a commit 70faf08
Show file tree
Hide file tree
Showing 10 changed files with 257 additions and 250 deletions.
1 change: 1 addition & 0 deletions demos/demo_git_compat.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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:"
Expand Down
10 changes: 4 additions & 6 deletions demos/demo_juggle_conflicts.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down
15 changes: 7 additions & 8 deletions demos/demo_resolve_conflicts.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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:"
Expand Down
22 changes: 12 additions & 10 deletions demos/demo_working_copy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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:"
Expand All @@ -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
47 changes: 24 additions & 23 deletions demos/git_compat.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 8 additions & 0 deletions demos/helpers.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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="$?"
Expand Down
Loading

0 comments on commit 70faf08

Please sign in to comment.