-
Notifications
You must be signed in to change notification settings - Fork 161
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conflicting merge decision with both addrange and removerange blows up UI #488
Comments
@vidartf would love to some feedback / help fixing this, if you have a few minutes. |
@itamarst Hi, just got back from vacation. Do you have a base/local/remote triplet for reproduction? Either full notebooks or relevant parts. I want to trace the decisions all the way from the backend to the frontend to make sure I understand the problem fully. In general, the merge tool is less polished than the other parts, so I'm a little hesitant to fix the other parts based on the behavior of the mergetool unless I'm sure it is the right thing to do. |
You can find a triplet here: https://github.com/dotmesh-io/nbdime/files/3403248/notebooks.zip |
Thanks for that, I was able to reproduce. WIP notes:
|
I tried the UI-fixing approach and it wasn't clear quite how to make the change. Could you perhaps give me a sketch of the necessary code and I can take it from there? |
I did a first rough like this without checking anything. If you could try it out and test/modify as needed, that would be a great help! @@ -313,6 +313,24 @@ function splitCellChunks(mergeDecisions: MergeDecision[]): MergeDecision[] {
'remote', // Check for custom action first?
md.conflict,
));
+ } else if (md.remoteDiff && md.localDiff) {
+ const ops = [md.remoteDiff[0].op, md.localDiff[0].op].sort();
+ if (ops.join(',') === 'addrange,removerange') {
+ // Insertion and deletions on the same index are simply split
+ // but both keep the conflict status
+
+ // Just do local first (alt. do add first)
+ let lmd = new MergeDecision(md);
+ lmd.localDiff = md.localDiff.slice();
+ lmd.remoteDiff = null;
+
+ let rmd = new MergeDecision(md);
+ rmd.localDiff = null;
+ rmd.remoteDiff = md.remoteDiff.slice();
+ output.push(rmd);
+ } else {
+ output.push(md); // deepCopy?
+ }
} else {
output.push(md); // deepCopy?
} |
I will try to get to this in next week or two (we're using the PR internally as workaround, and have some urgent stuff to get done, but do want the real fix here in upstream). |
Thanks for the sketch! |
The nbmerge-web UI TypeScript assumes
removerange
is only ever coupled withpatch
, but I've encountered case there's a conflictinglocal_then_remote
merge decision withaddrange
andremoverange
forlocal
andremote
respectively:There are two possible approaches to solving this:
addrange
andremoverange
.I initially attempted the first approach, but the assumption that
removerange
is only ever coupled withpatch
seems to go pretty deep, so I ended up doing the second approach instead.The text was updated successfully, but these errors were encountered: