forked from mirrors/jj
jj resolve
: List remaining conflicts (if any) on success
This can be prevented by the new `--quiet` option.
This commit is contained in:
parent
b8ba78b996
commit
5ecac4fc44
3 changed files with 37 additions and 2 deletions
|
@ -29,6 +29,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||
* `jj debug config-schema` command prints out JSON schema for the jj TOML config
|
||||
file format.
|
||||
|
||||
* `jj resolve` now notifies the user of remaining conflicts, if any, on success.
|
||||
This can be prevented by the new `--quiet` option.
|
||||
|
||||
### Fixed bugs
|
||||
|
||||
* When sharing the working copy with a Git repo, we used to forget to export
|
||||
|
|
|
@ -532,6 +532,10 @@ struct ResolveArgs {
|
|||
// `diff --summary`, but should be more verbose.
|
||||
#[arg(long, short)]
|
||||
list: bool,
|
||||
/// Do not print the list of remaining conflicts (if any) after resolving a
|
||||
/// conflict
|
||||
#[arg(long, short, conflicts_with = "list")]
|
||||
quiet: bool,
|
||||
/// Restrict to these paths when searching for a conflict to resolve. We
|
||||
/// will attempt to resolve the first conflict we can find. You can use
|
||||
/// the `--list` argument to find paths to use here.
|
||||
|
@ -2407,11 +2411,26 @@ fn cmd_resolve(
|
|||
commit.id().hex()
|
||||
));
|
||||
let new_tree_id = workspace_command.run_mergetool(ui, &commit.tree(), repo_path)?;
|
||||
tx.mut_repo()
|
||||
let new_commit = tx
|
||||
.mut_repo()
|
||||
.rewrite_commit(command.settings(), &commit)
|
||||
.set_tree(new_tree_id)
|
||||
.write()?;
|
||||
workspace_command.finish_transaction(ui, tx)
|
||||
workspace_command.finish_transaction(ui, tx)?;
|
||||
|
||||
if !args.quiet {
|
||||
let new_tree = new_commit.tree();
|
||||
let new_conflicts = new_tree.conflicts_matching(&EverythingMatcher);
|
||||
if !new_conflicts.is_empty() {
|
||||
ui.write("After this operation, some files at this revision still have conflicts:\n")?;
|
||||
print_conflicted_files(
|
||||
&new_conflicts,
|
||||
ui.stdout_formatter().as_mut(),
|
||||
&workspace_command,
|
||||
)?;
|
||||
}
|
||||
};
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn print_conflicted_files(
|
||||
|
|
|
@ -183,6 +183,8 @@ conflict
|
|||
@r###"
|
||||
Working copy now at: 0bb40c908c8b conflict
|
||||
Added 0 files, modified 1 files, removed 0 files
|
||||
After this operation, some files at this revision still have conflicts:
|
||||
file
|
||||
"###);
|
||||
insta::assert_snapshot!(
|
||||
std::fs::read_to_string(test_env.env_root().join("editor2")).unwrap(), @r###"
|
||||
|
@ -537,6 +539,8 @@ fn test_multiple_conflicts() {
|
|||
test_env.jj_cmd_success(&repo_path, &["resolve", "file2"]), @r###"
|
||||
Working copy now at: 06cafc2b5489 conflict
|
||||
Added 0 files, modified 1 files, removed 0 files
|
||||
After this operation, some files at this revision still have conflicts:
|
||||
file1
|
||||
"###);
|
||||
insta::assert_snapshot!(test_env.jj_cmd_success(&repo_path, &["diff"]),
|
||||
@r###"
|
||||
|
@ -554,6 +558,15 @@ fn test_multiple_conflicts() {
|
|||
file1
|
||||
"###);
|
||||
|
||||
// Repeat the above with the `--quiet` option.
|
||||
test_env.jj_cmd_success(&repo_path, &["undo"]);
|
||||
std::fs::write(&editor_script, "expect\n\0write\nresolution file2\n").unwrap();
|
||||
insta::assert_snapshot!(
|
||||
test_env.jj_cmd_success(&repo_path, &["resolve", "--quiet", "file2"]), @r###"
|
||||
Working copy now at: 02326c070aa4 conflict
|
||||
Added 0 files, modified 1 files, removed 0 files
|
||||
"###);
|
||||
|
||||
// For the rest of the test, we call `jj resolve` several times in a row to
|
||||
// resolve each conflict in the order it chooses.
|
||||
test_env.jj_cmd_success(&repo_path, &["undo"]);
|
||||
|
|
Loading…
Reference in a new issue