mirror of
https://github.com/martinvonz/jj.git
synced 2025-01-15 16:53:25 +00:00
cli_util: take conflicts by value to print_conflicted_paths()
I'm about to make the vector contain `BackendResult<MergedTreeValue>`, which is harder to work with behind a mutable reference.
This commit is contained in:
parent
81251c9382
commit
9ec216a2bb
3 changed files with 7 additions and 7 deletions
|
@ -1906,7 +1906,7 @@ See https://martinvonz.github.io/jj/latest/working-copy/#stale-working-copy \
|
|||
let conflicts = new_commit.tree()?.conflicts().collect_vec();
|
||||
if !conflicts.is_empty() {
|
||||
writeln!(formatter, "There are unresolved conflicts at these paths:")?;
|
||||
print_conflicted_paths(&conflicts, formatter.as_mut(), self)?;
|
||||
print_conflicted_paths(conflicts, formatter.as_mut(), self)?;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2467,7 +2467,7 @@ fn update_stale_working_copy(
|
|||
|
||||
#[instrument(skip_all)]
|
||||
pub fn print_conflicted_paths(
|
||||
conflicts: &[(RepoPathBuf, MergedTreeValue)],
|
||||
conflicts: Vec<(RepoPathBuf, MergedTreeValue)>,
|
||||
formatter: &mut dyn Formatter,
|
||||
workspace_command: &WorkspaceCommandHelper,
|
||||
) -> Result<(), CommandError> {
|
||||
|
@ -2480,8 +2480,8 @@ pub fn print_conflicted_paths(
|
|||
.into_iter()
|
||||
.map(|p| format!("{:width$}", p, width = max_path_len.min(32) + 3));
|
||||
|
||||
for ((_, conflict), formatted_path) in std::iter::zip(conflicts.iter(), formatted_paths) {
|
||||
let conflict = conflict.clone().simplify();
|
||||
for ((_, conflict), formatted_path) in std::iter::zip(conflicts, formatted_paths) {
|
||||
let conflict = conflict.simplify();
|
||||
let sides = conflict.num_sides();
|
||||
let n_adds = conflict.adds().flatten().count();
|
||||
let deletions = sides - n_adds;
|
||||
|
|
|
@ -91,7 +91,7 @@ pub(crate) fn cmd_resolve(
|
|||
}
|
||||
if args.list {
|
||||
return print_conflicted_paths(
|
||||
&conflicts,
|
||||
conflicts,
|
||||
ui.stdout_formatter().as_mut(),
|
||||
&workspace_command,
|
||||
);
|
||||
|
@ -129,7 +129,7 @@ pub(crate) fn cmd_resolve(
|
|||
formatter,
|
||||
"After this operation, some files at this revision still have conflicts:"
|
||||
)?;
|
||||
print_conflicted_paths(&new_conflicts, formatter.as_mut(), &workspace_command)?;
|
||||
print_conflicted_paths(new_conflicts, formatter.as_mut(), &workspace_command)?;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -93,7 +93,7 @@ pub(crate) fn cmd_status(
|
|||
formatter.labeled("conflict"),
|
||||
"There are unresolved conflicts at these paths:"
|
||||
)?;
|
||||
print_conflicted_paths(&conflicts, formatter, &workspace_command)?;
|
||||
print_conflicted_paths(conflicts, formatter, &workspace_command)?;
|
||||
}
|
||||
|
||||
let template = workspace_command.commit_summary_template();
|
||||
|
|
Loading…
Reference in a new issue