My hope would be to provide a simple 3 way merge if possible instead of automatically creating a conflict. If not possible then revert to current conflict mechanism. This would need to be implemented for each of the client versions (desktop, Android, iOS) which adds complications.
Current situation: If two users change a note at the same time and both sync then the later one to sync will get a conflict page which needs to be manually fixed.
Future desired situation: If two users change a note at the same time and both sync then the later one to sync will trigger a mechanism to attempt an automatic 3-way merge.
This automatic merge would use a 3 way merge library to compare (Base) The version stored in history, (local change) the user edits made locally, and (remote change) the version which was just retrieved from the server. If the merge can be successfully done (changes were made in different parts of the note) then the merged version is used as the current version of the note and a new sync is initiated. If there is a conflict (not a simple merge) then the current conflict mechanism is used.
Requirements for this to work:
- The history feature needs to be turned on.
- The history feature needs to be a reliable base - being saved ONLY on a valid sync. I don't know when history versions are created and if they would be suitable for the base of a 3-way merge.
- A suitable 3-way merge library needs to exist in the proper language with a good license, or one would need to be written. This needs to support a "merge ok" or "merge not ok" response to know if a simple merge is possible. If it is not possible then revert to the current conflict mechanism.
1 Like
I definitely think some kind of auto merging of conflicts would great, but in terms of the way the note history currently works in Joplin, it would need some changes to be a reliable base. Note versions can only be created once every 10 minutes (I previously submitted a PR to make this configurable and it was rejected) and the note history has a similar issue to Desktop, Mobile: Automatically retrigger the sync if there are more unsynced outgoing changes when sync completes by mrjo118 Ā· Pull Request #12989 Ā· laurent22/joplin Ā· GitHub but instead of having missed changes on completion of sync, it exhibits missed revisions for changes made within 10 minutes after a revision has been created for a note (or if no revisions exist prior to making a change).
I created this PR Desktop, Mobile: Fix historic issue whereby the first revision created for a note does not contain the original contents by mrjo118 Ā· Pull Request #12674 Ā· laurent22/joplin Ā· GitHub to mostly address the āmissed revisionā issue, but itās not looking too hopeful of being accepted to be honest.
1 Like
oh - I didnāt realize the note history was so disconnected from syncing.
Without a completely reliable way to have a base version from the last good sync I donāt think my idea will work at all.
Thanks for taking the time to explain how the note history works!
FYI there is a mobile compatible plugin which allows you to view the diff between notes, which might help with conflict resolution Joplin Plugins - Diff view
However it is not very user friendly for comparing large notes, so I have raised a bug and a feature request on the plugin repository. Also if using it to compare conflicts, it would help to rename the conflicting note before using the compare function, to make it clear which note is the original when selecting the note to compare to
Hey @mrjo118, I noticed that both of the PRs you mentioned did get merged. Thank you for your contributions, by the way. Do you think Joplin now reliably keeps a note revision history that could be used as a foundation for conflict resolution based on a 3-way merge?
Iām very interested in some kind of automatic conflict resolution as well. I have conflicts far too often for my ānormalā usage of keeping to-do lists.
1 Like
Not really. The revisions are limited to being produced every 10 minutes so the design isnāt really compatible. I have written up an automatic conflict resolution idea as one of the GSoC project ideas though, so if a suitable candidate comes up with a good proposal, we might get some better conflict resolution functionality added to Joplin this year