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

Re: Merging Branches

From: Patrick Dean Rusk <PRusk_at_foliage.com>
Date: 2004-09-03 21:25:57 CEST

Your situation is actually far easier to resolve than you might think.

I personally think the "right way" described in the Subversion book does not
work well at all for branches that last more than a couple days in an active
repository. It envisions that you branch, do work on that branch without
ever bringing over changes from the trunk, then merge your branch changes
back in.

My experience has been that branches need to periodically bring over changes
made to trunk, as you have experienced. So, here's what I've found to work

1) Cut your branch, noting the revision of the branch point, say "X".

2) After some time, merge revisions X+1 to HEAD into the branch. Note the
revision of HEAD, because that becomes your new "X". Your branch is
effectively now a branch from HEAD whose only difference is whatever changes
you made in the branch.

3) Keep doing step 2 until you're done with your branch changes.

4) Do step 2 one more time, so that you branch is completely up-to-date with
trunk's HEAD.

5) Now you merge the branch into trunk without any reference to revisions or
ranges at all. You're effectively replacing trunk's HEAD with the branch
HEAD. That's exactly what you want, because your branch now represents
(trunk + branch changes).

6) Do a check to make sure that no one snuck in another trunk revision
between 4 and 5. If so, you may need to merge that change into trunk.

I used this strategy in a 2500 file project where my branch affected 500+
files over a 5 week period. It worked perfectly.

Patrick Rusk

To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org
Received on Fri Sep 3 21:26:43 2004

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