mirror of
https://github.com/martinvonz/jj.git
synced 2025-01-18 02:04:19 +00:00
cli: proxy format_commit_summary() through transaction wrapper
At this point, tx.base_repo() is identical to tx.repo(), so the caller doesn't need to explicitly select the "base" one.
This commit is contained in:
parent
18e9679613
commit
e874570947
2 changed files with 15 additions and 10 deletions
|
@ -1044,6 +1044,13 @@ impl WorkspaceCommandTransaction<'_> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn format_commit_summary(&self, commit: &Commit) -> String {
|
||||||
|
let mut output = Vec::new();
|
||||||
|
self.write_commit_summary(&mut PlainTextFormatter::new(&mut output), commit)
|
||||||
|
.expect("write() to PlainTextFormatter should never fail");
|
||||||
|
String::from_utf8(output).expect("template output should be utf-8 bytes")
|
||||||
|
}
|
||||||
|
|
||||||
pub fn write_commit_summary(
|
pub fn write_commit_summary(
|
||||||
&self,
|
&self,
|
||||||
formatter: &mut dyn Formatter,
|
formatter: &mut dyn Formatter,
|
||||||
|
|
|
@ -2036,9 +2036,8 @@ Adjust the right side until the diff shows the changes you want to move
|
||||||
to the destination. If you don't make any changes, then all the changes
|
to the destination. If you don't make any changes, then all the changes
|
||||||
from the source will be moved into the destination.
|
from the source will be moved into the destination.
|
||||||
",
|
",
|
||||||
tx.base_workspace_helper().format_commit_summary(&source),
|
tx.format_commit_summary(&source),
|
||||||
tx.base_workspace_helper()
|
tx.format_commit_summary(&destination)
|
||||||
.format_commit_summary(&destination)
|
|
||||||
);
|
);
|
||||||
let new_parent_tree_id = tx.select_diff(
|
let new_parent_tree_id = tx.select_diff(
|
||||||
ui,
|
ui,
|
||||||
|
@ -2124,8 +2123,8 @@ Adjust the right side until the diff shows the changes you want to move
|
||||||
to the destination. If you don't make any changes, then all the changes
|
to the destination. If you don't make any changes, then all the changes
|
||||||
from the source will be moved into the parent.
|
from the source will be moved into the parent.
|
||||||
",
|
",
|
||||||
tx.base_workspace_helper().format_commit_summary(&commit),
|
tx.format_commit_summary(&commit),
|
||||||
tx.base_workspace_helper().format_commit_summary(parent)
|
tx.format_commit_summary(parent)
|
||||||
);
|
);
|
||||||
let new_parent_tree_id = tx.select_diff(
|
let new_parent_tree_id = tx.select_diff(
|
||||||
ui,
|
ui,
|
||||||
|
@ -2199,8 +2198,8 @@ the parent commit. The changes you edited out will be moved into the
|
||||||
child commit. If you don't make any changes, then the operation will be
|
child commit. If you don't make any changes, then the operation will be
|
||||||
aborted.
|
aborted.
|
||||||
",
|
",
|
||||||
tx.base_workspace_helper().format_commit_summary(parent),
|
tx.format_commit_summary(parent),
|
||||||
tx.base_workspace_helper().format_commit_summary(&commit)
|
tx.format_commit_summary(&commit)
|
||||||
);
|
);
|
||||||
new_parent_tree_id = tx.edit_diff(ui, &parent_base_tree, &parent.tree(), &instructions)?;
|
new_parent_tree_id = tx.edit_diff(ui, &parent_base_tree, &parent.tree(), &instructions)?;
|
||||||
if &new_parent_tree_id == parent_base_tree.id() {
|
if &new_parent_tree_id == parent_base_tree.id() {
|
||||||
|
@ -2478,8 +2477,7 @@ You are editing changes in: {}
|
||||||
|
|
||||||
Adjust the right side until it shows the contents you want. If you
|
Adjust the right side until it shows the contents you want. If you
|
||||||
don't make any changes, then the operation will be aborted.",
|
don't make any changes, then the operation will be aborted.",
|
||||||
tx.base_workspace_helper()
|
tx.format_commit_summary(&target_commit),
|
||||||
.format_commit_summary(&target_commit),
|
|
||||||
);
|
);
|
||||||
let base_tree = merge_commit_trees(tx.base_repo().as_repo_ref(), base_commits.as_slice());
|
let base_tree = merge_commit_trees(tx.base_repo().as_repo_ref(), base_commits.as_slice());
|
||||||
let tree_id = tx.edit_diff(ui, &base_tree, &target_commit.tree(), &instructions)?;
|
let tree_id = tx.edit_diff(ui, &base_tree, &target_commit.tree(), &instructions)?;
|
||||||
|
@ -2567,7 +2565,7 @@ Adjust the right side until it shows the contents you want for the first
|
||||||
(parent) commit. The remainder will be in the second commit. If you
|
(parent) commit. The remainder will be in the second commit. If you
|
||||||
don't make any changes, then the operation will be aborted.
|
don't make any changes, then the operation will be aborted.
|
||||||
",
|
",
|
||||||
tx.base_workspace_helper().format_commit_summary(&commit)
|
tx.format_commit_summary(&commit)
|
||||||
);
|
);
|
||||||
let tree_id = tx.select_diff(
|
let tree_id = tx.select_diff(
|
||||||
ui,
|
ui,
|
||||||
|
|
Loading…
Reference in a new issue