Skip to content
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

Move conflicts are not handled #57

Open
slarse opened this issue Mar 8, 2020 · 4 comments
Open

Move conflicts are not handled #57

slarse opened this issue Mar 8, 2020 · 4 comments
Labels
bug Something isn't working

Comments

@slarse
Copy link
Collaborator

slarse commented Mar 8, 2020

Root conflicts are not properly handled and will cause the same node to be inserted in multiple places. This will, quite obviously, mess some stuff up. I think however that it's fine to ignore root conflicts, as there's really no way to visualize them textually.

Anyway, for the PcsInterpreter to work, every SpoonNode in the PCS structure must only appear as a predecessor and successor precisely once. This means that if there are root conflicts, the conflicting nodes must be copied such the uniqueness of nodes is preserved.

@slarse slarse added the bug Something isn't working label Mar 8, 2020
@slarse slarse changed the title Root conflicts are not handled Move conflicts are not handled Mar 17, 2020
@slarse
Copy link
Collaborator Author

slarse commented Mar 17, 2020

It's not just root conflicts, but move conflicts in general. A root conflict is one thing, but if a node has been moved to two different places, but with the same parent, then it gets a bit tricky.

It may be easier to actually flag such cases as conflicts, rather than to allow them.

@slarse
Copy link
Collaborator Author

slarse commented Mar 17, 2020

Move conflicts can cause successor conflicts without a terminating predecessor conflict, which is really tricky to deal with.

@slarse
Copy link
Collaborator Author

slarse commented Mar 27, 2020

This was incorrectly closed by #73

@slarse
Copy link
Collaborator Author

slarse commented Mar 27, 2020

Root conflicts are actually something of a concern, I've found that they occur in roughly 5% of all file merges in the RxJava library, where both left and right revisions have altered the file.

I believe however that I have a solution for allowing root conflicts to pass, i.e. copying the conflicting nodes. It's pretty simple: whenever a root conflict is detected after a merge, remove the conflicting nodes from the SpoonMappings (and any mappings among their children) and restart the merge from the creation of the class representatives map. This will cause these previously moved nodes to not be detected as moves, but as deletions and insertions. It's an imperfect solution, but it's simple and I think it could work.

@slarse slarse added enhancement New feature or request bug Something isn't working and removed bug Something isn't working enhancement New feature or request labels May 24, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant