Implemented lock system against race conditions

Locks: Nobody else can commit the same document, if another commit or
resolve conflict is in progress
Fixed Bug, where resolving a merge conflict, did not update document
contents.