The results of thinking about merging

james on 2003-07-31T13:24:45

Right, so last time I said I was thinking about merging. So here are my thoughts.

If you detect a conflict (ie, the last local revision is older than the the last commited revision) you need to figure out if you can patch it.

To do this step, you find the greatest shared revision of both files and get a diff against them. Then you compare the hunks of the two diffs. If you have hunks that overlap then you have a conflict, and you need to throw that hunk away, or at least think about it very carefully before you attempt to apply it. Hunks that don't overlap are applied to the local copy.

If you don't have any overlapping hunks then the merge is flawless and easy -- its just a patch. I've not figured out how to do more granular merging but at least I can detect it and deal with it at some level, and this is a step in the right direction.

Now of course I need to implement it...


Just use an external tool

rafael on 2003-07-31T14:28:44

diff3 ! (in GNU diffutils)

If you are serious about this...

melopt on 2003-07-31T16:06:56

... then please include metadata that makes it easier to merge diferent branches.

the system should tag the merge point's and remmember the last merge between branches. That would make easier multiple merges.

Changeset's might make it easier also... But, I didn't think about those in detail.