mirror of
https://github.com/martinvonz/jj.git
synced 2025-01-18 18:27:38 +00:00
cli: make jj st
list paths with conflicts
Now that the working copy preserves conflicts, we can easily list them.
This commit is contained in:
parent
99e5a28d17
commit
c1bdba5403
1 changed files with 17 additions and 0 deletions
|
@ -2005,6 +2005,7 @@ fn cmd_status(
|
||||||
ui.write("Working copy : ")?;
|
ui.write("Working copy : ")?;
|
||||||
ui.write_commit_summary(repo.as_repo_ref(), &commit)?;
|
ui.write_commit_summary(repo.as_repo_ref(), &commit)?;
|
||||||
ui.write("\n")?;
|
ui.write("\n")?;
|
||||||
|
|
||||||
let mut conflicted_local_branches = vec![];
|
let mut conflicted_local_branches = vec![];
|
||||||
let mut conflicted_remote_branches = vec![];
|
let mut conflicted_remote_branches = vec![];
|
||||||
for (branch_name, branch_target) in repo.view().branches() {
|
for (branch_name, branch_target) in repo.view().branches() {
|
||||||
|
@ -2051,6 +2052,7 @@ fn cmd_status(
|
||||||
" Use `jj branches` to see details. Use `jj git pull` to resolve."
|
" Use `jj branches` to see details. Use `jj git pull` to resolve."
|
||||||
)?;
|
)?;
|
||||||
}
|
}
|
||||||
|
|
||||||
let parent_tree = commit.parents()[0].tree();
|
let parent_tree = commit.parents()[0].tree();
|
||||||
let tree = commit.tree();
|
let tree = commit.tree();
|
||||||
if tree.id() == parent_tree.id() {
|
if tree.id() == parent_tree.id() {
|
||||||
|
@ -2059,6 +2061,21 @@ fn cmd_status(
|
||||||
ui.write("Working copy changes:\n")?;
|
ui.write("Working copy changes:\n")?;
|
||||||
show_diff_summary(ui, repo, parent_tree.diff(&tree, &EverythingMatcher))?;
|
show_diff_summary(ui, repo, parent_tree.diff(&tree, &EverythingMatcher))?;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let conflicts = tree.conflicts();
|
||||||
|
if !conflicts.is_empty() {
|
||||||
|
ui.stdout_formatter().add_label("conflict".to_string())?;
|
||||||
|
writeln!(ui, "There are unresolved conflicts at these paths:")?;
|
||||||
|
ui.stdout_formatter().remove_label()?;
|
||||||
|
for (path, _) in conflicts {
|
||||||
|
writeln!(
|
||||||
|
ui,
|
||||||
|
"{}",
|
||||||
|
&ui.format_file_path(repo.working_copy_path(), &path)
|
||||||
|
)?;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue