ok/jj
1
0
Fork 0
forked from mirrors/jj

op log: change "resolve concurrent" to "reconcile divergent"

"Concurrent" operations are not necessarily actually concurrent, so
"divergent" seems like a better name. And "reconcile" seems like a
better term for merging them, though we also sometimes use "merge".
This commit is contained in:
Martin von Zweigbergk 2024-08-29 21:59:09 -07:00 committed by Martin von Zweigbergk
parent f963af3f16
commit cc15ecf7c7
15 changed files with 59 additions and 59 deletions

View file

@ -442,7 +442,7 @@ impl CommandHelper {
}
}
Ok(tx
.write("resolve concurrent operations")
.write("reconcile divergent operations")
.leave_unpublished()
.operation()
.clone())
@ -2510,14 +2510,14 @@ pub struct GlobalArgs {
/// Operation to load the repo at
///
/// Operation to load the repo at. By default, Jujutsu loads the repo at the
/// most recent operation, or at the merge of the concurrent operations if
/// most recent operation, or at the merge of the divergent operations if
/// any.
///
/// You can use `--at-op=<operation ID>` to see what the repo looked like at
/// an earlier operation. For example `jj --at-op=<operation ID> st` will
/// show you what `jj st` would have shown you when the given operation had
/// just finished. `--at-op=@` is pretty much the same as the default except
/// that concurrent operations will never be merged.
/// that divergent operations will never be merged.
///
/// Use `jj op log` to find the operation ID you want. Any unambiguous
/// prefix of the operation ID is enough.

View file

@ -55,7 +55,7 @@ pub fn cmd_op_abandon(
let repo_loader = workspace.repo_loader();
let op_store = repo_loader.op_store();
let op_heads_store = repo_loader.op_heads_store();
// It doesn't make sense to create concurrent operations that will be merged
// It doesn't make sense to create divergent operations that will be merged
// with the current head.
if command.global_args().at_operation.is_some() {
return Err(cli_error("--at-op is not respected"));
@ -129,7 +129,7 @@ pub fn cmd_op_abandon(
op_heads_store.update_op_heads(slice::from_ref(old.id()), new_id);
}
// Remap the operation id of the current workspace. If there were any
// concurrent operations, user will need to re-abandon their ancestors.
// divergent operations, user will need to re-abandon their ancestors.
if !command.global_args().ignore_working_copy {
let mut locked_ws = workspace.start_working_copy_mutation()?;
let old_op_id = locked_ws.locked_wc().old_operation_id();

View file

@ -28,8 +28,8 @@ use crate::ui::Ui;
/// Show the operation log
///
/// Like other commands, `jj op log` snapshots the current working-copy changes
/// and merges concurrent operations. Use `--at-op=@ --ignore-working-copy` to
/// inspect the current state without mutation.
/// and reconciles divergent operations. Use `--at-op=@ --ignore-working-copy`
/// to inspect the current state without mutation.
#[derive(clap::Args, Clone, Debug)]
pub struct OperationLogArgs {
/// Limit number of operations to show

View file

@ -46,7 +46,7 @@ pub fn cmd_workspace_update_stale(
_args: &WorkspaceUpdateStaleArgs,
) -> Result<(), CommandError> {
// Snapshot the current working copy on top of the last known working-copy
// operation, then merge the concurrent operations. The wc_commit_id of the
// operation, then merge the divergent operations. The wc_commit_id of the
// merged repo wouldn't change because the old one wins, but it's probably
// fine if we picked the new wc_commit_id.
let known_wc_commit = {

View file

@ -165,9 +165,9 @@ To get started, see the tutorial at https://github.com/martinvonz/jj/blob/main/d
This option only affects the check. It does not affect the `immutable_heads()` revset or the `immutable` template keyword.
* `--at-operation <AT_OPERATION>` — Operation to load the repo at
Operation to load the repo at. By default, Jujutsu loads the repo at the most recent operation, or at the merge of the concurrent operations if any.
Operation to load the repo at. By default, Jujutsu loads the repo at the most recent operation, or at the merge of the divergent operations if any.
You can use `--at-op=<operation ID>` to see what the repo looked like at an earlier operation. For example `jj --at-op=<operation ID> st` will show you what `jj st` would have shown you when the given operation had just finished. `--at-op=@` is pretty much the same as the default except that concurrent operations will never be merged.
You can use `--at-op=<operation ID>` to see what the repo looked like at an earlier operation. For example `jj --at-op=<operation ID> st` will show you what `jj st` would have shown you when the given operation had just finished. `--at-op=@` is pretty much the same as the default except that divergent operations will never be merged.
Use `jj op log` to find the operation ID you want. Any unambiguous prefix of the operation ID is enough.
@ -1362,7 +1362,7 @@ Compare changes to the repository between two operations
Show the operation log
Like other commands, `jj op log` snapshots the current working-copy changes and merges concurrent operations. Use `--at-op=@ --ignore-working-copy` to inspect the current state without mutation.
Like other commands, `jj op log` snapshots the current working-copy changes and reconciles divergent operations. Use `--at-op=@ --ignore-working-copy` to inspect the current state without mutation.
**Usage:** `jj operation log [OPTIONS]`

View file

@ -154,7 +154,7 @@ fn test_concurrent_operations_wc_modified() {
let stdout = test_env.jj_cmd_success(&repo_path, &["op", "log", "-Tdescription"]);
insta::assert_snapshot!(stdout, @r###"
@ snapshot working copy
resolve concurrent operations
reconcile divergent operations
new empty commit
new empty commit

View file

@ -637,7 +637,7 @@ fn test_new_conflicting_branches() {
],
);
// Trigger resolution of concurrent operations
// Trigger resolution of divergent operations
test_env.jj_cmd_ok(&repo_path, &["st"]);
let stderr = test_env.jj_cmd_failure(&repo_path, &["new", "foo"]);
@ -660,7 +660,7 @@ fn test_new_conflicting_change_ids() {
test_env.jj_cmd_ok(&repo_path, &["describe", "-m", "one"]);
test_env.jj_cmd_ok(&repo_path, &["--at-op=@-", "describe", "-m", "two"]);
// Trigger resolution of concurrent operations
// Trigger resolution of divergent operations
test_env.jj_cmd_ok(&repo_path, &["st"]);
let stderr = test_env.jj_cmd_failure(&repo_path, &["new", "qpvuntsm"]);

View file

@ -563,8 +563,8 @@ fn test_op_abandon_multiple_heads() {
let (stdout, stderr) = test_env.jj_cmd_ok(&repo_path, &["op", "log"]);
insta::assert_snapshot!(stdout, @r###"
@ a232d055d331 test-username@host.example.com 2001-02-03 04:05:17.000 +07:00 - 2001-02-03 04:05:17.000 +07:00
resolve concurrent operations
@ fb7f33a29cd8 test-username@host.example.com 2001-02-03 04:05:17.000 +07:00 - 2001-02-03 04:05:17.000 +07:00
reconcile divergent operations
args: jj op log
467d42715f00 test-username@host.example.com 2001-02-03 04:05:10.000 +07:00 - 2001-02-03 04:05:10.000 +07:00
commit 220cb0b1b5d1c03cc0d351139d824598bb3c1967
@ -847,8 +847,8 @@ fn test_op_diff() {
"###);
let stdout = test_env.jj_cmd_success(&repo_path, &["op", "log"]);
insta::assert_snapshot!(&stdout, @r###"
@ 6eeb006eccd0 test-username@host.example.com 2001-02-03 04:05:16.000 +07:00 - 2001-02-03 04:05:16.000 +07:00
resolve concurrent operations
@ afab0949fddc test-username@host.example.com 2001-02-03 04:05:16.000 +07:00 - 2001-02-03 04:05:16.000 +07:00
reconcile divergent operations
args: jj log
984d5ceb039f test-username@host.example.com 2001-02-03 04:05:07.000 +07:00 - 2001-02-03 04:05:07.000 +07:00
check out git remote's default branch
@ -877,7 +877,7 @@ fn test_op_diff() {
);
insta::assert_snapshot!(&stdout, @r###"
From operation 984d5ceb039f: check out git remote's default branch
To operation 6eeb006eccd0: resolve concurrent operations
To operation afab0949fddc: reconcile divergent operations
Changed local branches:
branch-1:
@ -894,7 +894,7 @@ fn test_op_diff() {
);
insta::assert_snapshot!(&stdout, @r###"
From operation 5ed581429582: point branch branch-1 to commit 3d9189bc56a1972729350456eb95ec5bf90be2a8
To operation 6eeb006eccd0: resolve concurrent operations
To operation afab0949fddc: reconcile divergent operations
Changed commits:
Change sqpuoqvxutmz
@ -927,8 +927,8 @@ fn test_op_diff() {
"###);
let stdout = test_env.jj_cmd_success(&repo_path, &["op", "diff"]);
insta::assert_snapshot!(&stdout, @r###"
From operation 6eeb006eccd0: resolve concurrent operations
To operation 9c57642e4a18: fetch from git remote(s) origin
From operation afab0949fddc: reconcile divergent operations
To operation aa3c1cbed385: fetch from git remote(s) origin
Changed commits:
Change qzxslznxxpoz
@ -969,8 +969,8 @@ fn test_op_diff() {
"###);
let stdout = test_env.jj_cmd_success(&repo_path, &["op", "diff"]);
insta::assert_snapshot!(&stdout, @r###"
From operation 9c57642e4a18: fetch from git remote(s) origin
To operation 8b280b4a5ea2: create branch branch-2 pointing to commit d487febd08e690ee775a4e0387e30d544307e409
From operation aa3c1cbed385: fetch from git remote(s) origin
To operation be49cc959876: create branch branch-2 pointing to commit d487febd08e690ee775a4e0387e30d544307e409
Changed local branches:
branch-2:
@ -987,8 +987,8 @@ fn test_op_diff() {
"###);
let stdout = test_env.jj_cmd_success(&repo_path, &["op", "diff"]);
insta::assert_snapshot!(&stdout, @r###"
From operation 8b280b4a5ea2: create branch branch-2 pointing to commit d487febd08e690ee775a4e0387e30d544307e409
To operation be38bc6501bc: track remote branch branch-2@origin
From operation be49cc959876: create branch branch-2 pointing to commit d487febd08e690ee775a4e0387e30d544307e409
To operation c6bace1690a5: track remote branch branch-2@origin
Changed remote branches:
branch-2@origin:
@ -1008,8 +1008,8 @@ fn test_op_diff() {
"###);
let stdout = test_env.jj_cmd_success(&repo_path, &["op", "diff"]);
insta::assert_snapshot!(&stdout, @r###"
From operation be38bc6501bc: track remote branch branch-2@origin
To operation 8c9091fb718a: new empty commit
From operation c6bace1690a5: track remote branch branch-2@origin
To operation 06ad17cad045: new empty commit
Changed commits:
Change nmzmmopxokps
@ -1028,8 +1028,8 @@ fn test_op_diff() {
"###);
let stdout = test_env.jj_cmd_success(&repo_path, &["op", "diff"]);
insta::assert_snapshot!(&stdout, @r###"
From operation 8c9091fb718a: new empty commit
To operation 6ff61c177324: point branch branch-1 to commit bed2698f6baf06f7eea56c616bc3fe36d9065651
From operation 06ad17cad045: new empty commit
To operation f98d2aca274d: point branch branch-1 to commit bed2698f6baf06f7eea56c616bc3fe36d9065651
Changed local branches:
branch-1:
@ -1047,8 +1047,8 @@ fn test_op_diff() {
"###);
let stdout = test_env.jj_cmd_success(&repo_path, &["op", "diff"]);
insta::assert_snapshot!(&stdout, @r###"
From operation 6ff61c177324: point branch branch-1 to commit bed2698f6baf06f7eea56c616bc3fe36d9065651
To operation ecae5e879b40: delete branch branch-2
From operation f98d2aca274d: point branch branch-1 to commit bed2698f6baf06f7eea56c616bc3fe36d9065651
To operation 238af436e327: delete branch branch-2
Changed local branches:
branch-2:
@ -1070,8 +1070,8 @@ fn test_op_diff() {
"###);
let stdout = test_env.jj_cmd_success(&repo_path, &["op", "diff"]);
insta::assert_snapshot!(&stdout, @r###"
From operation ecae5e879b40: delete branch branch-2
To operation 96f11847b661: push all tracked branches to git remote origin
From operation 238af436e327: delete branch branch-2
To operation c5aa1d1304a6: push all tracked branches to git remote origin
Changed commits:
Change uuuvxpvwspwr
@ -1290,8 +1290,8 @@ fn test_op_show() {
// Showing a merge operation is empty.
let stdout = test_env.jj_cmd_success(&repo_path, &["op", "show"]);
insta::assert_snapshot!(&stdout, @r###"
6c131cd79314 test-username@host.example.com 2001-02-03 04:05:14.000 +07:00 - 2001-02-03 04:05:14.000 +07:00
resolve concurrent operations
40495fbd29b6 test-username@host.example.com 2001-02-03 04:05:14.000 +07:00 - 2001-02-03 04:05:14.000 +07:00
reconcile divergent operations
args: jj log
"###);
@ -1308,7 +1308,7 @@ fn test_op_show() {
"###);
let stdout = test_env.jj_cmd_success(&repo_path, &["op", "show"]);
insta::assert_snapshot!(&stdout, @r###"
84466f397d80 test-username@host.example.com 2001-02-03 04:05:16.000 +07:00 - 2001-02-03 04:05:16.000 +07:00
1ed37acf8335 test-username@host.example.com 2001-02-03 04:05:16.000 +07:00 - 2001-02-03 04:05:16.000 +07:00
fetch from git remote(s) origin
args: jj git fetch
@ -1351,7 +1351,7 @@ fn test_op_show() {
"###);
let stdout = test_env.jj_cmd_success(&repo_path, &["op", "show"]);
insta::assert_snapshot!(&stdout, @r###"
eea894b7c72f test-username@host.example.com 2001-02-03 04:05:18.000 +07:00 - 2001-02-03 04:05:18.000 +07:00
61235941fe15 test-username@host.example.com 2001-02-03 04:05:18.000 +07:00 - 2001-02-03 04:05:18.000 +07:00
create branch branch-2 pointing to commit d487febd08e690ee775a4e0387e30d544307e409
args: jj branch create branch-2 -r branch-2@origin
@ -1370,7 +1370,7 @@ fn test_op_show() {
"###);
let stdout = test_env.jj_cmd_success(&repo_path, &["op", "show"]);
insta::assert_snapshot!(&stdout, @r###"
d2d43732186a test-username@host.example.com 2001-02-03 04:05:20.000 +07:00 - 2001-02-03 04:05:20.000 +07:00
18035ff599c1 test-username@host.example.com 2001-02-03 04:05:20.000 +07:00 - 2001-02-03 04:05:20.000 +07:00
track remote branch branch-2@origin
args: jj branch track branch-2@origin
@ -1392,7 +1392,7 @@ fn test_op_show() {
"###);
let stdout = test_env.jj_cmd_success(&repo_path, &["op", "show"]);
insta::assert_snapshot!(&stdout, @r###"
f85f06d144b6 test-username@host.example.com 2001-02-03 04:05:22.000 +07:00 - 2001-02-03 04:05:22.000 +07:00
6ae7eab9f2c5 test-username@host.example.com 2001-02-03 04:05:22.000 +07:00 - 2001-02-03 04:05:22.000 +07:00
new empty commit
args: jj new branch-1@origin -m 'new commit'
@ -1413,7 +1413,7 @@ fn test_op_show() {
"###);
let stdout = test_env.jj_cmd_success(&repo_path, &["op", "show"]);
insta::assert_snapshot!(&stdout, @r###"
b55c8d9fdc63 test-username@host.example.com 2001-02-03 04:05:24.000 +07:00 - 2001-02-03 04:05:24.000 +07:00
044836a4ea77 test-username@host.example.com 2001-02-03 04:05:24.000 +07:00 - 2001-02-03 04:05:24.000 +07:00
point branch branch-1 to commit 71fe694da7811a184f404fffe35cd62b0adb3d89
args: jj branch set branch-1 -r @
@ -1433,7 +1433,7 @@ fn test_op_show() {
"###);
let stdout = test_env.jj_cmd_success(&repo_path, &["op", "show"]);
insta::assert_snapshot!(&stdout, @r###"
25dbc902dbf0 test-username@host.example.com 2001-02-03 04:05:26.000 +07:00 - 2001-02-03 04:05:26.000 +07:00
6595a222e6f1 test-username@host.example.com 2001-02-03 04:05:26.000 +07:00 - 2001-02-03 04:05:26.000 +07:00
delete branch branch-2
args: jj branch delete branch-2
@ -1457,7 +1457,7 @@ fn test_op_show() {
"###);
let stdout = test_env.jj_cmd_success(&repo_path, &["op", "show"]);
insta::assert_snapshot!(&stdout, @r###"
d8d2184e1621 test-username@host.example.com 2001-02-03 04:05:28.000 +07:00 - 2001-02-03 04:05:28.000 +07:00
c69699290f76 test-username@host.example.com 2001-02-03 04:05:28.000 +07:00 - 2001-02-03 04:05:28.000 +07:00
push all tracked branches to git remote origin
args: jj git push --tracked

View file

@ -199,7 +199,7 @@ fn test_workspaces_add_at_operation() {
let stdout = test_env.jj_cmd_success(&secondary_path, &["op", "log", "-Tdescription"]);
insta::assert_snapshot!(stdout, @r###"
@ snapshot working copy
resolve concurrent operations
reconcile divergent operations
commit cd06097124e3e5860867e35c2bb105902c28ea38
create initial working-copy commit in workspace secondary

View file

@ -201,7 +201,7 @@ a revision will resolve to all potential targets. That means that `jj new main`
will error out, complaining that the revset resolved to multiple revisions.
Both local branches (e.g. `main`) and the remote branch (e.g. `main@origin`) can
have conflicts. Both can end up in that state if concurrent operations were run
have conflicts. Both can end up in that state if divergent operations were run
in the repo. The local branch more typically becomes conflicted because it was
updated both locally and on a remote.

View file

@ -26,7 +26,7 @@ The following operators are supported:
* `x+`: Children of `x`
## Concurrent operations
## divergent operations
One benefit of the operation log (and the reason for its creation) is that it
allows lock-free concurrency -- you can run concurrent `jj` commands without

View file

@ -64,7 +64,7 @@ Git, losing a branch pointer does not lead to losing commits.
## Operation log
The most important piece in the lock-free design is the "operation log". That is
what allows us to detect and merge concurrent operations.
what allows us to detect and merge divergent operations.
The operation log is similar to a commit DAG (such as in
[Git's object model](https://git-scm.com/book/en/v2/Git-Internals-Git-Objects)),
@ -75,14 +75,14 @@ contains a pointer to the view object (like how commit objects point to tree
objects), pointers to parent operation(s) (like how commit objects point to
parent commit(s)), and metadata about the operation. These types are defined
in `op_store.proto` The operation log is normally linear.
It becomes non-linear if there are concurrent operations.
It becomes non-linear if there are divergent operations.
When a command starts, it loads the repo at the latest operation. Because the
associated view object completely defines the repo state, the running command
will not see any changes made by other processes thereafter. When the operation
completes, it is written with the start operation as parent. The operation
cannot fail to commit (except for disk failures and such). It is left for the
next command to notice if there were concurrent operations. It will have to be
next command to notice if there were divergent operations. It will have to be
able to do that anyway since the concurrent operation could have arrived via a
distributed file system. This model -- where each operation sees a consistent
view of the repo and is guaranteed to be able to commit their changes -- greatly
@ -94,9 +94,9 @@ will result in a fork in the operation log. That works exactly the same as if
any later operations had not existed when the command started. In other words,
running commands on a repo loaded at an earlier operation works the same way as
if the operations had been concurrent. This can be useful for simulating
concurrent operations.
divergent operations.
### Merging concurrent operations
### Merging divergent operations
If Jujutsu tries to load the repo and finds multiple heads in the operation log,
it will do a 3-way merge of the view objects based on their common ancestor

View file

@ -791,7 +791,7 @@ impl RepoLoader {
self.merge_operations(
user_settings,
op_heads,
Some("resolve concurrent operations"),
Some("reconcile divergent operations"),
)
}

View file

@ -1066,7 +1066,7 @@ fn test_import_refs_reimport_conflicted_remote_branch() {
let mut tx2 = repo.start_transaction(&settings);
git::import_refs(tx2.mut_repo(), &git_settings).unwrap();
// Remote branch can diverge by concurrent operations (like `jj git fetch`)
// Remote branch can diverge by divergent operations (like `jj git fetch`)
let repo = commit_transactions(&settings, vec![tx1, tx2]);
assert_eq!(
repo.view().get_git_ref("refs/remotes/origin/main"),

View file

@ -81,7 +81,7 @@ fn test_heads_merge() {
#[test]
fn test_merge_views_heads() {
// Tests merging of the view's heads (by performing concurrent operations).
// Tests merging of the view's heads (by performing divergent operations).
let settings = testutils::user_settings();
let test_repo = TestRepo::init();
let repo = &test_repo.repo;
@ -113,7 +113,7 @@ fn test_merge_views_heads() {
#[test]
fn test_merge_views_checkout() {
// Tests merging of the view's checkout (by performing concurrent operations).
// Tests merging of the view's checkout (by performing divergent operations).
let settings = testutils::user_settings();
let test_repo = TestRepo::init();
let repo = &test_repo.repo;
@ -203,7 +203,7 @@ fn test_merge_views_checkout() {
#[test]
fn test_merge_views_branches() {
// Tests merging of branches (by performing concurrent operations). See
// Tests merging of branches (by performing divergent operations). See
// test_refs.rs for tests of merging of individual ref targets.
let settings = testutils::user_settings();
let test_repo = TestRepo::init();
@ -295,7 +295,7 @@ fn test_merge_views_branches() {
#[test]
fn test_merge_views_tags() {
// Tests merging of tags (by performing concurrent operations). See
// Tests merging of tags (by performing divergent operations). See
// test_refs.rs for tests of merging of individual ref targets.
let settings = testutils::user_settings();
let test_repo = TestRepo::init();
@ -339,7 +339,7 @@ fn test_merge_views_tags() {
#[test]
fn test_merge_views_git_refs() {
// Tests merging of git refs (by performing concurrent operations). See
// Tests merging of git refs (by performing divergent operations). See
// test_refs.rs for tests of merging of individual ref targets.
let settings = testutils::user_settings();
let test_repo = TestRepo::init();
@ -395,7 +395,7 @@ fn test_merge_views_git_refs() {
#[test]
fn test_merge_views_git_heads() {
// Tests merging of git heads (by performing concurrent operations). See
// Tests merging of git heads (by performing divergent operations). See
// test_refs.rs for tests of merging of individual ref targets.
let settings = testutils::user_settings();
let test_repo = TestRepo::init();