| 1 |
#!/bin/bash |
| 2 |
set -euo pipefail |
| 3 |
. "$(dirname "$0")"/helpers.sh |
| 4 |
|
| 5 |
new_tmp_dir |
| 6 |
{ |
| 7 |
jj git clone https://github.com/octocat/Hello-World |
| 8 |
cd Hello-World |
| 9 |
jj abandon --ignore-immutable test@origin |
| 10 |
jj bookmark forget test |
| 11 |
jj abandon --ignore-immutable octocat-patch-1@origin |
| 12 |
jj bookmark forget octocat-patch-1 |
| 13 |
}> /dev/null 2>&1 |
| 14 |
|
| 15 |
comment "We are in the octocat/Hello-World repo. |
| 16 |
We have an empty working copy on top of master:" |
| 17 |
run_command "jj log" |
| 18 |
run_command "jj status" |
| 19 |
|
| 20 |
comment "Now make some changes in the working copy:" |
| 21 |
run_command "echo \"Goodbye World!\" > README" |
| 22 |
run_command "echo stuff > new-file" |
| 23 |
|
| 24 |
comment "Because of these changes, our working copy is no longer marked as \"(empty)\". |
| 25 |
Also, its commit ID (starting with a blue character) changed:" |
| 26 |
run_command "jj status" |
| 27 |
|
| 28 |
comment "Add a bookmark so we can easily refer to this |
| 29 |
commit:" |
| 30 |
run_command "jj bookmark create goodbye" |
| 31 |
run_command "jj log" |
| 32 |
|
| 33 |
comment "Start working on a new change off of master:" |
| 34 |
run_command "jj new master" |
| 35 |
comment "Note that we were told the working copy is now empty (AKA clean). The |
| 36 |
\"goodbye\" change stayed in its own commit:" |
| 37 |
|
| 38 |
run_command "jj log" |
| 39 |
comment "Let's do a sanity check: 'jj status' should tell us that |
| 40 |
the working copy is clean." |
| 41 |
run_command "jj status" |
| 42 |
|
| 43 |
comment "Modify a file in this new change:" |
| 44 |
run_command "echo \"Hello everyone!\" > README" |
| 45 |
run_command "jj status" |
| 46 |
|
| 47 |
comment "The working copy is not special; we can, for |
| 48 |
example, set the description of any commit. |
| 49 |
First, set it on the working copy:" |
| 50 |
# The output with the description of the working copy slightly messes up the |
| 51 |
# parallel between the working copy and another commit, so we redact it. |
| 52 |
run_command_output_redacted "jj describe -m everyone" |
| 53 |
|
| 54 |
comment "Now set it on the change we worked on before:" |
| 55 |
run_command "jj describe goodbye -m goodbye" |
| 56 |
|
| 57 |
comment "Inspect the result:" |
| 58 |
run_command "jj log" |