ok/jj
1
0
Fork 0
forked from mirrors/jj
jj/demos/demo_working_copy.sh
Ilya Grigoriev 1cc10783a2 demos: update demos as little as possible to regenerate them
This updates demos to the point where they can run without
warnings. Some of them become less clear, this is addressed
(where I noticed it) in follow-up commits.

Fixes #3209
2024-09-05 17:33:46 -07:00

58 lines
1.8 KiB
Bash
Executable file

#!/bin/bash
set -euo pipefail
. "$(dirname "$0")"/helpers.sh
new_tmp_dir
{
jj git clone https://github.com/octocat/Hello-World
cd Hello-World
jj abandon --ignore-immutable test@origin
jj branch forget test
jj abandon --ignore-immutable octocat-patch-1@origin
jj branch forget octocat-patch-1
}> /dev/null 2>&1
comment "We are in the octocat/Hello-World repo.
We have an empty working copy on top of master:"
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 "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"
comment "Add a branch so we can easily refer to this
commit:"
run_command "jj branch create goodbye"
run_command "jj log"
comment "Start working on a new change off of master:"
run_command "jj new master"
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:"
# The output with the description of the working copy slightly messes up the
# parallel between the working copy and another commit, 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"