mirror of
https://github.com/jj-vcs/jj.git
synced 2025-12-23 06:01:01 +00:00
split: add conflict labels
This commit is contained in:
parent
5fd1b2fd5b
commit
042b3838a3
1 changed files with 15 additions and 3 deletions
|
|
@ -20,6 +20,8 @@ use jj_lib::backend::CommitId;
|
|||
use jj_lib::commit::Commit;
|
||||
use jj_lib::matchers::Matcher;
|
||||
use jj_lib::merge::Diff;
|
||||
use jj_lib::merge::Merge;
|
||||
use jj_lib::merged_tree::MergedTree;
|
||||
use jj_lib::object_id::ObjectId as _;
|
||||
use jj_lib::rewrite::CommitWithSelection;
|
||||
use jj_lib::rewrite::EmptyBehavior;
|
||||
|
|
@ -339,9 +341,19 @@ pub(crate) fn cmd_split(
|
|||
// Merge the original commit tree with its parent using the tree
|
||||
// containing the user selected changes as the base for the merge.
|
||||
// This results in a tree with the changes the user didn't select.
|
||||
target_tree
|
||||
.merge_unlabeled(target.selected_tree.clone(), target.parent_tree.clone())
|
||||
.block_on()?
|
||||
let selected_diff = target.diff_with_labels(
|
||||
"parents of split commit",
|
||||
"selected changes for split",
|
||||
"split commit",
|
||||
)?;
|
||||
MergedTree::merge(Merge::from_diffs(
|
||||
(
|
||||
target_tree,
|
||||
format!("split commit ({})", target.commit.conflict_label()),
|
||||
),
|
||||
[selected_diff.invert()],
|
||||
))
|
||||
.block_on()?
|
||||
} else {
|
||||
target_tree
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue