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

[TSVN] Feature branch merging (was Merge dialog)

From: Simon Large <slarge_at_blazepoint.co.uk>
Date: 2005-01-25 13:17:09 CET

matthew ford wrote:
> Can you detail more of the steps in branching and merging
> particularly in regard to
> the syncing process.
> I am just getting my head around merging and thought it was a good
> idea to , at the end of the branch development and befor merging back
> to the trunk to merge from the trunk to the branch to check for
> compatibility and then merge from the branch back to the trunk for
> the final result.
> But I am a bit worried about new trunk changes being added twice
> once to the branch and then once back to the trunk again.

This process is quite well documented in the _online_ version of the
subversion book. Ben Collins Sussman has updated it in the last couple
of weeks to give more examples.

It looks as if the operation you want to perform is described here:

http://svnbook.red-bean.com/en/1.1/ch04s04.html#svn-ch-4-sect-4.1

in the section on Feature Branches. Note that there is an error in the
CLI commands in this section: the parameter order of trunk and branch is
reversed. Ben knows, but has not had time to update the doc yet.

There are 2 stages as you have correctly identified:
1. Keep the branch synchronized with changes from the trunk. It is
recommended that you do this regularly, say once a week. It keeps your
branch up to date with all the latest bugfixes from trunk. You need to
keep track of which trunk revisions you have merged to avoid the
repeated merge problem.

From the branch WC you select the trunk URL for both From and To, and
select the range of revisions you want to merge across to the branch
(remember that the 'From' revision is the one _before_ the first rev you
want to be merged, ie. it is the last revision you merged last time).

2. Merge the branch back into the trunk. Provided you have kept the
branch in sync with the trunk changes, then the branch will contain all
the trunk changes _plus_ your new feature. Effectively you want to
overwrite the trunk with the branch code.

merge performs: trunk = trunk + (branch - trunk)
which effectively means: trunk = branch

The way to do this is to do one final sync to make sure you have all the
trunk changes in the branch. Commit those changes and note the revision
number of that commit. Now the only difference between the 2 trees is
your new feature, so you want to merge the difference between trunk and
branch back into trunk.

Switch your WC back to the trunk.
In the merge dialog, the 'From' URL is the trunk, the 'To' URL is the
branch (this sounds wrong, but remember that we are generating a
difference file), and in both cases the revision should be the one you
noted earlier when you sync'ed the branch. If you are sure there have
been no other commits since you last sync'ed the branch you could use
HEAD in both cases instead.
Start the merge.

When the merge is complete, the trunk should be exactly the same as the
branch.

Hope this helps,

Simon

-- 
       ___
  oo  // \\      "De Chelonian Mobile"
 (_,\/ \_/ \     TortoiseSVN
   \ \_/_\_/>    The coolest Interface to (Sub)Version Control
   /_/   \_\     http://tortoisesvn.tigris.org
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tortoisesvn.tigris.org
For additional commands, e-mail: dev-help@tortoisesvn.tigris.org
Received on Tue Jan 25 13:17:15 2005

This is an archived mail posted to the TortoiseSVN Dev mailing list.