I'm trying to understand the conflict resolution protocol of CouchDB (the selection of the winning revision). So far I understand that CouchDB does essentially this:
1) Finds the revision with the highest number and if there are no other revisions with the same number then it is declared the winner. 2) If there are several revisions with the same revision number, then the one with the lowest revision ID is selected (Erlang's string comparison function is used to find the lowest string). After the winner is found everything else is straightforward - revision trees are aligned, conflicting revisions are stored, extra revisions are stemmed, etc. I'm going to document all of my findings for the future developers who might be interested to use CouchDB with other systems.
