2021-10-23 16:06:40 +00:00
|
|
|
#!/bin/bash
|
|
|
|
set -euo pipefail
|
2023-08-28 22:42:44 +00:00
|
|
|
. "$(dirname "$0")"/helpers.sh
|
2021-10-23 16:06:40 +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
|
|
|
|
jj abandon test
|
|
|
|
jj branch forget test
|
|
|
|
} > /dev/null
|
2021-10-23 16:06:40 +00:00
|
|
|
|
2022-10-21 05:13:09 +00:00
|
|
|
comment "We are on the master branch of the
|
|
|
|
octocat/Hello-World repo:"
|
2023-09-10 04:17:47 +00:00
|
|
|
run_command "jj log"
|
2022-10-21 05:13:09 +00:00
|
|
|
|
|
|
|
comment "Let's make an edit that will conflict
|
|
|
|
when we rebase it:"
|
2021-10-27 22:07:46 +00:00
|
|
|
run_command "jj describe -m \"README: say which world\""
|
2021-10-23 16:06:40 +00:00
|
|
|
run_command "echo \"Hello Earth!\" > README"
|
|
|
|
run_command "jj diff"
|
2022-10-21 05:13:09 +00:00
|
|
|
|
2023-09-10 04:17:47 +00:00
|
|
|
# TODO(ilyagr): Get the real shortest prefix of the b1b commit using `jj log
|
|
|
|
# --no-graph` and the `.shortest()` template function.
|
|
|
|
#
|
|
|
|
# This could also be done in demo_git_compat.sh, but that might not be worth it.
|
2022-10-21 05:13:09 +00:00
|
|
|
comment "We're going to rebase it onto commit b1.
|
|
|
|
That commit looks like this:"
|
2021-10-23 16:06:40 +00:00
|
|
|
run_command "jj diff -r b1"
|
2022-10-21 05:13:09 +00:00
|
|
|
|
|
|
|
comment "Now rebase:"
|
2021-10-23 16:06:40 +00:00
|
|
|
run_command "jj rebase -d b1"
|
2022-10-21 05:13:09 +00:00
|
|
|
|
2023-09-10 04:17:47 +00:00
|
|
|
comment "That seemed to succeed but we are also told there is now a conflict.
|
|
|
|
Let's take a look at the repo:"
|
2023-09-10 04:17:47 +00:00
|
|
|
run_command "jj log"
|
2021-11-06 23:08:00 +00:00
|
|
|
run_command "jj status"
|
2022-10-21 05:13:09 +00:00
|
|
|
|
2023-09-10 04:17:47 +00:00
|
|
|
comment "Indeed, the rebased commit has a conflict. The conflicted file
|
|
|
|
in the working copy looks like this:"
|
2021-10-23 16:06:40 +00:00
|
|
|
run_command "cat README"
|
2022-10-21 05:13:09 +00:00
|
|
|
|
|
|
|
comment "Now we will resolve the conflict:"
|
2021-10-23 16:06:40 +00:00
|
|
|
run_command "echo \"Hello earth!\" > README"
|
2022-10-21 05:13:09 +00:00
|
|
|
|
|
|
|
comment "The status command no longer reports it:"
|
2021-11-06 23:08:00 +00:00
|
|
|
run_command "jj status"
|
2023-02-09 00:26:55 +00:00
|
|
|
|
|
|
|
blank
|