[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: Understanding merging

From: Ulrich Eckhardt <ulrich.eckhardt_at_dominolaser.com>
Date: Wed, 9 Mar 2011 11:09:38 +0100

On Tuesday 08 March 2011, Steve Cohen wrote:
> Given two branches off a trunk that were taken at different times, if
> the first is merged back to the trunk and then the second, how may the
> second be merged back into the trunk so as not to override changes from
> the first merge, assuming that both change sets are desired to be in the
> trunk at the end?

I think that thinking in terms of changesets is the way to go. Let's assume
trunk is this at the time that branch A is made:

 trunk = T0 + T1 + T2

i.e. trunk is the sum (not in the strict mathematical sense) of three changes
here (those could be more or less changes, this is just for the example).
Then, branch A becomes this after some time:

 branch A = T0 + T1 + T2 + A0 + A1 + A2

In other words, the branch contains the changes to the trunk up to the point
the branch was created plus its own changes on top of that.

If you now merge branch A back to the trunk, it becomes this:

 trunk = T0 + T1 + T2 + T3 + T4 + (A0 + A1 + A2)
       = T0 + T1 + T2 + T3 + T4 + T5

In other words, changeset T5 becomes the accumulated changes on branch A.
Subversion knows that the branch was created off the trunk after T2, so those
changes are already included in the trunk and they are not merged again, only
those changes that were exclusive to the branch are.

The important point is that not the whole state is copied from a branch to the
trunk during merging, but the changes are applied, so any other changes
already present are not overwritten.

Uli

-- 
ML: http://subversion.apache.org/docs/community-guide/mailing-lists.html
FAQ: http://subversion.apache.org/faq.html
Docs: http://svnbook.red-bean.com/
**************************************************************************************
Domino Laser GmbH, Fangdieckstraße 75a, 22547 Hamburg, Deutschland
Geschäftsführer: Thorsten Föcking, Amtsgericht Hamburg HR B62 932
**************************************************************************************
Visit our website at <http://www.dominolaser.com/>
**************************************************************************************
Diese E-Mail einschließlich sämtlicher Anhänge ist nur für den Adressaten bestimmt und kann vertrauliche Informationen enthalten. Bitte benachrichtigen Sie den Absender umgehend, falls Sie nicht der beabsichtigte Empfänger sein sollten. Die E-Mail ist in diesem Fall zu löschen und darf weder gelesen, weitergeleitet, veröffentlicht oder anderweitig benutzt werden.
E-Mails können durch Dritte gelesen werden und Viren sowie nichtautorisierte Änderungen enthalten. Domino Laser GmbH ist für diese Folgen nicht verantwortlich.
**************************************************************************************
Received on 2011-03-09 11:08:07 CET

This is an archived mail posted to the Subversion Users mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.