While thinking about "symmetric merge", it occurred to me recently that the 
existing "sync" and "reintegrate" merges can already be used to achieve 
to-and-fro merging between a pair of branches, without needing and keep-alive 
dance [1] or other measures.  This behaviour seems to be something that has not 
been noticed but falls out of the existing design.

Assuming we are doing "complete" merges (that is, automatically merge all new 
changes each time) between a pair of branches,

  * To merge again in the same direction as the previous merge
    => the existing "sync" merge will work.

  * To merge again in the opposite direction to the previous merge
    => the existing "reintegrate" merge will work.

Example:

Copy A to make a new branch B.

Merge A->B -- use a "sync" merge

Merge A->B -- use a "sync" merge

Merge B->A -- use a "reintegrate" merge

Merge B->A -- use a "sync" merge

Merge B->A -- use a "sync" merge

Merge A->B -- use a "reintegrate" merge

Merge A->B -- use a "sync" merge

Merge A->B -- use a "sync" merge
and so on.

Each reintegrate will be conflict-free if you do a sync (in the opposite 
direction, of course) just before it, just like traditional "reintegrate" 
usage; or if you don't, then during the reintegrate you may get conflicts.  
Either way, the conflicts you'll get are only the new ones that result from the 
new changes made since the last merge.  (In contrast, if you use the wrong kind 
of merge then you will also get conflicts due to Subversion merging changes 
unnecessarily, changes that are already present in the target branch.)


One of the main implications is that "symmertric merge" can be understood (by 
those familiar with Subversion's existing merges) in terms of selecting the 
correct kind of merge and then performing it.

Another is that users could actually achieve to-and-fro merging manually with 
Subversion 1.7, if they remember which direction the last merge was and apply 
this rule.  However, I wouldn't recommend we particularly advertize this, as it 
seems more likely to confuse than help most people.


- Julian


[1] Here's where we originally document the "keep-alive dance": 
<http://svnbook.red-bean.com/en/1.6/svn-book.html#svn.branchmerge.advanced.reintegratetwice>.
 And here's where I describe the problem with it: 
<http://wiki.apache.org/subversion/SymmetricMerge#The_Keep-Alive_Dance>.

Reply via email to