2021-10-22 20:56:30 +00:00
|
|
|
#!/bin/bash
|
|
|
|
set -euo pipefail
|
2023-08-28 22:42:44 +00:00
|
|
|
. "$(dirname "$0")"/helpers.sh
|
2021-10-22 20:56:30 +00:00
|
|
|
|
|
|
|
new_tmp_dir
|
2023-09-10 04:17:47 +00:00
|
|
|
{
|
|
|
|
jj git clone https://github.com/octocat/Hello-World
|
|
|
|
cd Hello-World
|
2024-08-08 05:00:46 +00:00
|
|
|
jj abandon --ignore-immutable test@origin
|
2023-09-10 04:17:47 +00:00
|
|
|
jj branch forget test
|
2024-08-08 05:00:46 +00:00
|
|
|
jj abandon --ignore-immutable octocat-patch-1@origin
|
2023-09-10 04:17:47 +00:00
|
|
|
jj branch forget octocat-patch-1
|
2024-08-08 05:00:46 +00:00
|
|
|
}> /dev/null 2>&1
|
2021-10-22 20:56:30 +00:00
|
|
|
|
2022-10-21 05:13:09 +00:00
|
|
|
comment "We are in the octocat/Hello-World repo.
|
|
|
|
We have an empty working copy on top of master:"
|
2021-10-28 03:38:56 +00:00
|
|
|
run_command "jj log"
|
2023-09-10 04:17:47 +00:00
|
|
|
run_command "jj status"
|
2022-10-21 05:13:09 +00:00
|
|
|
|
|
|
|
comment "Now make some changes in the working copy:"
|
2021-10-22 20:56:30 +00:00
|
|
|
run_command "echo \"Goodbye World!\" > README"
|
|
|
|
run_command "echo stuff > new-file"
|
2022-10-21 05:13:09 +00:00
|
|
|
|
2023-09-10 04:17:47 +00:00
|
|
|
comment "Because of these changes, our working copy is no longer marked as \"(empty)\".
|
|
|
|
Also, its commit ID (starting with a blue character) changed:"
|
2021-10-22 20:56:30 +00:00
|
|
|
run_command "jj status"
|
2022-10-21 05:13:09 +00:00
|
|
|
|
|
|
|
comment "Add a branch so we can easily refer to this
|
|
|
|
commit:"
|
2022-06-09 20:58:34 +00:00
|
|
|
run_command "jj branch create goodbye"
|
2021-10-28 03:38:56 +00:00
|
|
|
run_command "jj log"
|
2022-10-21 05:13:09 +00:00
|
|
|
|
|
|
|
comment "Start working on a new change off of master:"
|
2024-08-08 05:00:46 +00:00
|
|
|
run_command "jj new master"
|
2023-09-10 04:17:47 +00:00
|
|
|
comment "Note that we were told the working copy is now empty (AKA clean). The
|
2022-10-21 05:13:09 +00:00
|
|
|
\"goodbye\" change stayed in its own commit:"
|
2023-09-10 04:17:47 +00:00
|
|
|
|
|
|
|
run_command "jj log"
|
|
|
|
comment "Let's do a sanity check: 'jj status' should tell us that
|
|
|
|
the working copy is clean."
|
2021-10-22 20:56:30 +00:00
|
|
|
run_command "jj status"
|
2022-10-21 05:13:09 +00:00
|
|
|
|
|
|
|
comment "Modify a file in this new change:"
|
2021-10-22 20:56:30 +00:00
|
|
|
run_command "echo \"Hello everyone!\" > README"
|
2023-09-10 04:17:47 +00:00
|
|
|
run_command "jj status"
|
2022-10-21 05:13:09 +00:00
|
|
|
|
|
|
|
comment "The working copy is not special; we can, for
|
|
|
|
example, set the description of any commit.
|
|
|
|
First, set it on the working copy:"
|
2023-09-10 04:17:47 +00:00
|
|
|
# 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"
|
2022-10-21 05:13:09 +00:00
|
|
|
|
|
|
|
comment "Now set it on the change we worked on before:"
|
2021-10-22 20:56:30 +00:00
|
|
|
run_command "jj describe goodbye -m goodbye"
|
2022-10-21 05:13:09 +00:00
|
|
|
|
|
|
|
comment "Inspect the result:"
|
2021-10-22 20:56:30 +00:00
|
|
|
run_command "jj log"
|