[cvsnt] Re: Branch merging - this seems wrong...

Tony Eva teva at Airspan.com
Wed Jun 7 11:11:12 BST 2006


Community technical support mailing list was retired 2010 and replaced with a professional technical support team. For assistance please contact: Pre-sales Technical support via email to sales@march-hare.com.


First off, let me just say that Andreas and Gerhard have both expressed
concisely and clearly exactly what I have been trying so poorly to say
all along.  I agree with their comments 100%. 

Tony Hoyle wrote:
> Andreas Krey wrote:
>   > Now, since the revisions A2 and A3 are already present in B,
> > we can not base the merge on revision A1. Instead we need 
> to look into 
> > the graph finding the closest common revision, which is A3. We have 
> > change lines A3->B2-B3 and A3->A4, meaning that we need to do diff3 
> > with A3 as base and A4 and B3 als leaves.
> 
> In that case you'd lose the changes in B1....  you need that 
> change as well, and since the other merges are potentially 
> dependent on it you need to start there at a minimum.  The 
> mergepoint doesn't help here.

No - the changes in B1 are not lost.  B2 is not just a copy of A3, it is
a merged sum of B1 and A3.

It's easy to illustrate this with some example data.  For clarity, we
say that in the case of merge collisions we wish to add the colliding
lines from both files to the merge result.  (File contents given after
each version number, leading + used to indicate an added line.)


 + branch A
 |
1.1   First line A
 |
 +------------create branch--------+ branch B
 |                                 |
 |                              1.1.2.1   First line A
 |                                 |     +Second line B
1.2   First line A                 |
 |   +Second line A                |
 |                                 |
 |                              1.1.2.2   First line A
 |                                 |      Second line B
 |                                 |     +Third line B
1.3   First line A                 |
 |    Second line A                |
 |   +Third line A                 |
 |                                 |
 +------------merge-----------> 1.1.2.3   First line A
 |                                 |      Second line A
 |                                 |      Second line B
 |                                 |      Third line A
 |                                 |      Third line B
 |                                 |
1.4   First line A                 |
      Second line A                |
      Third line A                 |
     +Fourth line A                |
                                   |
                                1.1.2.4   First line A
                                          Second line A
                                          Second line B
                                          Third line A
                                          Third line B
                                         +Sixth line B


Now when B is merged back to A, the resulting file should be a merge of
the changes from both branches:

First line A
Second line A
Second line B
Third line A
Third line B
Fourth line A
Sixth line B

This is exactly what you get if you use 1.3 as the merge base point.
Nothing is lost because 1.1.2.3 includes the lines that were added in
1.1.2.1 and 1.1.2.2.  1.1.2.3 is a sum of branch A and branch B and
includes *both* of their histories up to the merge.

If you use 1.1 as the merge base point however, the lines that were
added in 1.2 and 1.3 appear twice in the merge diffs (once for A, once
for B) because they have been duplicated from branch A to branch B
during the first merge from A to B.

-- 
Tony



More information about the cvsnt mailing list
Download the latest CVSNT, TortosieCVS, WinCVS etc. for Windows 8 etc.
@CVSNT on Twitter   CVSNT on Facebook