fix(TreeBuilder::build_conflict): resolve not-really conflicts (left and right agree) #188
No reviewers
Labels
No labels
Compat/Breaking
Kind
Bad merge
Kind
Bug
Kind
Documentation
Kind
Enhancement
Kind
Feature
Kind
New language
Kind
Security
Kind
Testing
Priority
Critical
Priority
High
Priority
Low
Priority
Medium
Reviewed
Confirmed
Reviewed
Duplicate
Reviewed
Invalid
Reviewed
Won't Fix
Status
Abandoned
Status
Blocked
Status
Need More Info
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: mergiraf/mergiraf#188
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "ada4a:not_really_a_conflict"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
depends on #187
fixes #170 (see there for motivation and discussion)
67cf86a8d5
to4b8b38c9a9
4b8b38c9a9
to679c0eabd2
fix(TreeBuilder::build_conflict): resolve non-really conflicts (left and right agree)to fix(TreeBuilder::build_conflict): resolve not-really conflicts (left and right agree)679c0eabd2
to14366323e4
14366323e4
to353e4c95c8
353e4c95c8
to8a11b6f32a
WIP'd because I think there's another solution: #170 (comment)
fix(TreeBuilder::build_conflict): resolve not-really conflicts (left and right agree)to WIP: fix(TreeBuilder::build_conflict): resolve not-really conflicts (left and right agree)MergedTree::line_based_local_fallback_for_revnode
WIP: fix(TreeBuilder::build_conflict): resolve not-really conflicts (left and right agree)to fix(TreeBuilder::build_conflict): resolve not-really conflicts (left and right agree)The last commit could be a separate PR
cursor
in the method instead of getting it frombuild_conflict
#201@ -451,0 +451,4 @@
debug_assert!(
list_left.len() <= 1,
"I don't really know what it means for these lists to have more than one element"
Do we agree that it's clear that
list_left
can be of length more than outside of thisif
block, for any conflict that has more than a single element on the left-hand side?Then, I think
list_left
can very well still be of length more than one inside theif
. That would happen when the tree matching heuristic failed to match not just one pair of left/right elements, but multiple elements (consecutive children of the same parent).I'm not sure I completely understand you. You probably meant "
list_left
can be of length more than one outside of thisif
block"? If yes, then... sure, that sounds right.Ohh, I think I understand it now. Each
list
is, well, a list of PCS nodes, starting from a given divergence point (where we started to build the conflict) to a point where the two given revisions converge again?As I said, as I was writing the comment, I didn't really understand what any of this meant. Funnily enough, now that I do get it, the comments in
extract_conflict_side
look pretty obvious. I guess that's just the curse of knowledge, and I'll try to rewrite the comment so that it's actually helpful to someone who isn't already familiar with the method.But back to the question. I now agree that the lists may well be of length
1+ (but surely not 0 -- otherwise we wouldn't have calledEDIT: nevermind, both sides could've removed their node, so their corresponding lists can in fact both end up being empty. So I guess this is really similar to what we do atbuild_conflict
in the first place, no?)if let PCSNode::Node { node: leader, .. } = node {
if let Some(commutative_parent) = self
.lang_profile
.get_commutative_parent(leader.grammar_name())
{
let solved_conflict = self.resolve_commutative_conflict(
conflict,
commutative_parent,
visiting_state,
)?;
children.extend(solved_conflict);
} else {
children.push(conflict);
}
} else {
children.push(conflict);
}
after we get the conflict - we can either manage to resolve it, in which case we
children.extend(resolved)
, or don't, in which case wechildren.push(conflict)
. But that's only done on conflicts that turn out to be commutative -- I think we should add similar logic for when it's not. Or rather, expandresolve_commutative_conflict
so that it also checks for isomorphic left and right sides (and returnsVec<MergedTree>
if they are) before continuing on with the rest of its logic. We could rename it totry_resolve_conflict
to reflect the fact that it now handles all the cases where a conflict can be resolved.let-else
This PR's history has become kind of messy. I'll wait for your response, and, if you agree with my proposal, will open a new PR to implement it
MergedTree::line_based_local_fallback_for_revnode
): handle the case of isomorphic left and right sides #203@ada4a wrote in #188 (comment):
done, see #203
@ada4a wrote in #188 (comment):
I went ahead and did that already, so that you can see what I have in mind
extract_conflict_side
#205Superseded by #204.
Pull request closed