This is related to version control, in a parallel modification situation where we do not know the exact timing of changes, so we assume that we receive two modified versions of a file at the same time. I simplify the problem:
I have a string S, with two modified versions, called T and U. I can see the differences between S and T using diff. Let's call the patch made out of T over S, as PT. The same for U, we will have PU. Now, I want to merge PT and PU into one single patch, in a safe way, being able to detect the conflicts between PT and PU at a "word" level, not the typical programming line level.
questions:
1- Is there such an algorithm to merge two patches?
2- How can I detect the conflicts between T and U?
3- What's a common policy for dealing with conflicts? to me, one solution is to always choose the changes from one of the versions, say T, in case of a conflict.
Are there any tools out there to do what I am looking for?