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

A proof-of-concept merge algorithm implementation #63

Open
gf-mse opened this issue Aug 7, 2022 · 1 comment
Open

A proof-of-concept merge algorithm implementation #63

gf-mse opened this issue Aug 7, 2022 · 1 comment

Comments

@gf-mse
Copy link
Contributor

gf-mse commented Aug 7, 2022

I am using NB on a number of devices -- starting with multiple Firefox profiles and ending up with at home / at work notes, and so I spent some time thinking of the best way to automatically merge different board revisions -- until 4jag's uploaded his wonderful example and I realized that we don't actually have to.

(And as one could easily conclude from the whole source control software industry experience, in general case this is not even possible, to start with)

The rest was easy.

First, we introduce some unique ids for our notes -- so that we can cheat and say "hey, this is the same note" when we look at two different board revisions. And second, we leave the hard work of resolving note merge conflicts to the board owner, simply writing the old and new versions of the note text one on top on another, pretty much the same as old-school merge conflict editors do.
(In addition, some visual highlight for such "merge conflict" cases would be a nice to have.)

Now all we have to do when merging two boards is to create an index {(note id) => (note data)}, and to incrementally add our notes to that index, "merging" two notes with the same id.

Here is a more detailed description of the above, along with a proof-of-concept implementation (check the gif for a demo) :

Sadly I am not a design genius like Alexander, so board merging commands and the like simply go to Nullboard menu, along with some keyboard shortcuts to make repetitive operations a tad easier.

Lastly, this, again, is a proof-of-concept project, so while it works, there are some unpolished bits here and there -- for example, I did not update the board format code (shame on me!) or did not introduce a check that all board elements are of the new format and e.g. all the notes have unique ids before merging. Please check the proof-of-concept warning ssection of the README file for details.

However, the same README file has a fairly detailed description of the revision history, which shall make it relatively easy to explore the code, if intended.

@apankrat Alexander, please kindly let me know your thoughts, when you have time.


Tagging: #2, #54 .

@apankrat
Copy link
Owner

Based purely on the gif screencap - this is awesome. Let me read through the rest carefully and I will comment then.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants