Manyana, a robust architecture that forms the foundation of next-generation version control systems, leverages CRDT to excel in merging and rebasing.



The history of version control systems began with

SCCS (Source Code Control System) in 1972, and Git is now the dominant system. Over its long history, version control systems have become increasingly convenient, but the question remains: 'How will they evolve in the future?' The ' Manyana ' project is attracting attention as a candidate for the architecture of the next generation of version control systems, offering an answer to this question.

bramcohen/manyana
https://github.com/bramcohen/manyana

Manyana - by Bram Cohen - Bram's Thoughts
https://bramcohen.com/p/manyana

One of the key features of Manyana, developed by Bram Cohen , is its use of CRDT (Conflict-free Replicated Data Type) . CRDT stands for 'Conflict-free Replicated Data Type,' and by using CRDT in a version control system, it is expected that merges will always succeed by definition. In other words, it can avoid situations where conflict resolution fails in traditional version control systems. Manyana sets a 'conflict' flag when changes affect each other, ensuring that conflict resolution never fails and providing useful conflict information.

In traditional version control systems, when a conflict occurs, there may be cases where you have to deduce 'what happened' depending on the situation. As a clear example, let's consider a case where two people edit the following function simultaneously and then merge the results.
[code]
def calculate(x):
a = x * 2
b = a + 1
return b
[code]


Let's assume that one person deletes the function above, and the other person adds debug output to the function. In a traditional version control system, this would result in the following:
[code]
left
=======
def calculate(x):
a = x * 2
logger.debug(f'a={a}')
b = a + 1
return b
>>>>>>> right
[code]


It's difficult to instantly understand what happened just by looking at the above, but in Manyana it will be displayed as follows:
[code]
<<<<<<< begin delete left
def calculate(x):
a = x * 2
======= begin added right
logger.debug(f'a={a}')
======= begin deleted left
b = a + 1
return b
>>>>>>> end argument
[code]


With the information above, it's immediately clear that 'on one hand, the entire function was deleted' and 'on the other hand, a line of debug output was added to the function,' making it easier to understand the nature of the conflict. The decision left to the worker is narrowed down to just one point: 'Which change should we adopt?', making conflict resolution much simpler.

The benefit of implementing CRDT in a version control system is 'eventual consistency.' Eventual consistency means that 'all users will see the same data,' guaranteeing that merges will never fail and that the results will always be the same regardless of the merge order. Therefore, the following benefits can be obtained in various aspects of version control:

- Fixed line order : The order of inserted code is determined and maintained by the CRDT, preventing problems that can arise from different resolution orders in different branches.
Conflicts are for informational purposes : Conflicts no longer signify a failure to resolve, but rather serve to provide users with information such as a 'history of each operation.'
Structured history : CRDT maintains and provides a structured history of operations, ensuring that the correct results are always obtained without having to search for previous states or traverse DAGs .



In particular, the idea that Cohen is most excited about is 'improvements to rebasing.' With traditional rebasing, when you apply your changes to the latest main commit, a fictitious history is created where the commit was made on top of the latest main commit, thus destroying the original history. This destruction of history is precisely why Git rebasing operations should, in principle, be completed within the local repository. By using CRDT, the only additional element required during rebasing is to add information about the 'most important ancestor commit' to the DAG, so the history will not be destroyed by rebasing.

At the time of writing, Manyana is a demo version consisting of approximately 470 lines of Python code that provides minimal functionality for individual files, and is not yet a full-fledged version control system. However, it clearly demonstrates that a robust architecture, which forms the basis of a version control system that is resilient to merges and conflicts, can be built by utilizing CRDT, making Manyana a project with promising future developments.

in Software, Posted by log1c_sh