Skip to content

Commit

Permalink
op log: change "resolve concurrent" to "reconcile divergent"
Browse files Browse the repository at this point in the history
"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".
  • Loading branch information
martinvonz committed Aug 31, 2024
1 parent f963af3 commit cc15ecf
Show file tree
Hide file tree
Showing 15 changed files with 59 additions and 59 deletions.
6 changes: 3 additions & 3 deletions cli/src/cli_util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -442,7 +442,7 @@ impl CommandHelper {
}
}
Ok(tx
.write("resolve concurrent operations")
.write("reconcile divergent operations")
.leave_unpublished()
.operation()
.clone())
Expand Down Expand Up @@ -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.
Expand Down
4 changes: 2 additions & 2 deletions cli/src/commands/operation/abandon.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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"));
Expand Down Expand Up @@ -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();
Expand Down
4 changes: 2 additions & 2 deletions cli/src/commands/operation/log.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion cli/src/commands/workspace/update_stale.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down
6 changes: 3 additions & 3 deletions cli/tests/[email protected]
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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]`
Expand Down
2 changes: 1 addition & 1 deletion cli/tests/test_concurrent_operations.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions cli/tests/test_new_command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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"]);
Expand All @@ -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"]);
Expand Down
58 changes: 29 additions & 29 deletions cli/tests/test_operations.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 [email protected] 2001-02-03 04:05:17.000 +07:00 - 2001-02-03 04:05:17.000 +07:00
├─╮ resolve concurrent operations
@ fb7f33a29cd8 [email protected] 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 [email protected] 2001-02-03 04:05:10.000 +07:00 - 2001-02-03 04:05:10.000 +07:00
│ │ commit 220cb0b1b5d1c03cc0d351139d824598bb3c1967
Expand Down Expand Up @@ -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 [email protected] 2001-02-03 04:05:16.000 +07:00 - 2001-02-03 04:05:16.000 +07:00
├─╮ resolve concurrent operations
@ afab0949fddc [email protected] 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 [email protected] 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
Expand Down Expand Up @@ -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:
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand All @@ -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:
Expand All @@ -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
Expand All @@ -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:
Expand All @@ -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:
Expand All @@ -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
Expand Down Expand Up @@ -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 [email protected] 2001-02-03 04:05:14.000 +07:00 - 2001-02-03 04:05:14.000 +07:00
resolve concurrent operations
40495fbd29b6 [email protected] 2001-02-03 04:05:14.000 +07:00 - 2001-02-03 04:05:14.000 +07:00
reconcile divergent operations
args: jj log
"###);

Expand All @@ -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 [email protected] 2001-02-03 04:05:16.000 +07:00 - 2001-02-03 04:05:16.000 +07:00
1ed37acf8335 [email protected] 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
Expand Down Expand Up @@ -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 [email protected] 2001-02-03 04:05:18.000 +07:00 - 2001-02-03 04:05:18.000 +07:00
61235941fe15 [email protected] 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
Expand All @@ -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 [email protected] 2001-02-03 04:05:20.000 +07:00 - 2001-02-03 04:05:20.000 +07:00
18035ff599c1 [email protected] 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
Expand All @@ -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 [email protected] 2001-02-03 04:05:22.000 +07:00 - 2001-02-03 04:05:22.000 +07:00
6ae7eab9f2c5 [email protected] 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'
Expand All @@ -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 [email protected] 2001-02-03 04:05:24.000 +07:00 - 2001-02-03 04:05:24.000 +07:00
044836a4ea77 [email protected] 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 @
Expand All @@ -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 [email protected] 2001-02-03 04:05:26.000 +07:00 - 2001-02-03 04:05:26.000 +07:00
6595a222e6f1 [email protected] 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
Expand All @@ -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 [email protected] 2001-02-03 04:05:28.000 +07:00 - 2001-02-03 04:05:28.000 +07:00
c69699290f76 [email protected] 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
Expand Down
2 changes: 1 addition & 1 deletion cli/tests/test_workspaces.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion docs/branches.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down
2 changes: 1 addition & 1 deletion docs/operation-log.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 5 additions & 5 deletions docs/technical/concurrency.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)),
Expand All @@ -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
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion lib/src/repo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -791,7 +791,7 @@ impl RepoLoader {
self.merge_operations(
user_settings,
op_heads,
Some("resolve concurrent operations"),
Some("reconcile divergent operations"),
)
}

Expand Down
Loading

0 comments on commit cc15ecf

Please sign in to comment.