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

Re: merging/branches practices

From: Vincent Starre <vstarre_at_comcast.net>
Date: 2006-03-08 21:35:51 CET

Aaron Montgomery wrote:

> This is a (newbie) question about merging/branching. I have read the
> Subversion documentation but don't remember anything like this
> although I am guessing that the situation below isn't that uncommon
> so maybe I misunderstood something in the docs.
>
> Here's the situation:
>
> A main branch (/trunk) is shared by everyone in the project.
>
> I create a personal branch called (/branches/aaron) at revision 100
> by copying /trunk and I work in that branch. Along the way, I
> occasionally merge changes occurring in /trunk back to /branches/
> aaron (begin careful not to repeat a merge). Assume that the last
> merge of /trunk into /branches/aaron occurred at revision 200.
>
> Now I've reached a milepost in /branches/aaron (at revision 300) and
> would like at this point to completely resync my personal branch with
> /trunk (porting my changes in the branch back to trunk and then
> basically starting the process over from scratch). I do not want to
> eliminate my personal branch since I will continue working on it.
>
> Here is something like what I think should be done, but it looks
> somewhat convoluted and parts of it really make me wonder if I'm
> merging the correct patches. (The syntax here should be close enough
> for you to get the meaning, but it probably isn't exactly correct).
>
> cd aaron_wc
> svn merge -r200:300 repository/trunk .
> [[ handle any conflicts ]]
> svn commit .
> [[ we're now at version 301, differences in aaron and trunk are the
> result of my changes in aaron ]]
>
> cd trunk_wc
> svn update .
> svn merge -r200:301 repository/branches/aaron
> [[ handle any conflicts ]]
> [[ how should I handle it if someone commits a new revision in here? ]]
> svn commit .
> [[ we're now at version 302 ]]
>
> svn copy repository/trunk repository/branches/aaron
> cd trunk_wc
> svn update .
> [[ or should I merge trunk into aaron here insead of a copy and
> update?]]
>
> Thanks in advance for any comments,
> Aaron

When you are certain you want a complete sync:
(first, merge branch changes into trunk, then...)
$ cd branch_wc
$ svn merge repos/branch repos/trunk .
(here examine changes with svn diff to be sure you aren't squashing any
branch changes you forgot to merge back to trunk)
$ svn ci

and probably tag the syncpoint.

Note: be sure you do svn merge branch trunk, not the other way around.
This drove me crazy last week and I just did it backwards /again/ when
typing this message and only noticed as I was about to hit send :)

You are merging the Difference between Branch and Trunk into the working
copy, resulting in a Working Copy which is the same as Trunk.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org
Received on Wed Mar 8 21:38:54 2006

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