You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@subversion.apache.org by Peter Provost <pe...@microsoft.com> on 2004/12/14 04:55:25 UTC

Merge From Trunk to Branch

Hello all,
 
I searched the archives and google and couldn't get a clear picture of
the right way to do what I want.
 
Let me setup and example.
 
Suppose we have a project that is using the standard structure:

FooProject
 |
 +- trunk
 |
 +- branches
 |
 +- tags

And further assume that a developer has made a branch named "Bar" under
branches.

The URL to the trunk is svn://svnserver/FooProject/trunk and the URL to
the
developer's branch is svn://svnserver/FooProject/branches/Bar.

So far so good.

The developer has been working away from the trunk for a couple of days
(bad.. I 
know, but bear with me). They aren't yet ready to merge from their
branch back
into the trunk, but they want to merge from the trunk down to their
branch to
minimize the pain later and keep their branch as close to in-sync as
they can.

The developer has done 'svn log --stop-on-copy
svn://svnserver/FooProject/branches/Bar'
to figure out the repository revision of when the branch was made: 135.
The current
revision of the trunk is 164. The developer's working copy is fully
committed to his
branch.

So, again, what he wants to do is to merge all changes in the trunk
since 135 down into
his branch without changing the trunk.

What is the right way to accomplish this?

I suspect it is something like 'svn merge' from the branch to the trunk
and then 
instead of committing to the trunk, doing a 'svn switch' back to the
branch, 
but since I haven't used switch before I'm not 100% sure.

Can someone please help me out here? It seems like this would be a
common occurance
for people who use branches much.

Thanks in advance,

Peter

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org


Re: Merge From Trunk to Branch

Posted by Hugo Villeneuve <hu...@hugovil.com>.
> 
> And further assume that a developer has made a branch named "Bar" under
> branches.
> 
> The URL to the trunk is svn://svnserver/FooProject/trunk and the URL to
> the
> developer's branch is svn://svnserver/FooProject/branches/Bar.
> 
> So far so good.
> 
> The developer has been working away from the trunk for a couple of days
> (bad.. I 
> know, but bear with me). They aren't yet ready to merge from their
> branch back
> into the trunk, but they want to merge from the trunk down to their
> branch to
> minimize the pain later and keep their branch as close to in-sync as
> they can.
> 
> The developer has done 'svn log --stop-on-copy
> svn://svnserver/FooProject/branches/Bar'
> to figure out the repository revision of when the branch was made: 135.
> The current
> revision of the trunk is 164. The developer's working copy is fully
> committed to his
> branch.
> 
> So, again, what he wants to do is to merge all changes in the trunk
> since 135 down into
> his branch without changing the trunk.
> 
> What is the right way to accomplish this?
> 
> I suspect it is something like 'svn merge' from the branch to the trunk
> and then 
> instead of committing to the trunk, doing a 'svn switch' back to the
> branch, 
> but since I haven't used switch before I'm not 100% sure.
> 
> Can someone please help me out here? It seems like this would be a
> common occurance
> for people who use branches much.
> 
> Thanks in advance,
> 
> Peter

Hi Peter,
   If you work on a local copy, you could do:

    cd FooProject
    svn merge -r 135:164 trunk branches/Bar
 
(you can also replace "-r 135:164" with "-r 135:HEAD")

This way, you can easily check if it works the way you intend to, and revert if it's not. It's the same thing as a standard merge from a branch to the trunk, you just switch the source and destination.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org

Re: Merge From Trunk to Branch

Posted by Sean Laurent <se...@neuronfarm.com>.
On Monday 13 December 2004 10:55 pm, Peter Provost wrote:
<TEXT DELETED>
> The developer has done 'svn log --stop-on-copy
> svn://svnserver/FooProject/branches/Bar'
> to figure out the repository revision of when the branch was made: 135.
> The current
> revision of the trunk is 164. The developer's working copy is fully
> committed to his
> branch.
>
> So, again, what he wants to do is to merge all changes in the trunk
> since 135 down into
> his branch without changing the trunk.

That's the key right there... he will want to merge all changes that happened 
on the trunk between r135 and HEAD into his working copy of the branch.

Let's pretend he has the project checked out as:

/FooProject
	/trunk
	/branches
		/Bar

The easiest way to handle the merge, imho, is to do the following:

$ cd /FooProject/branches/Bar
$ svn merge -r135:HEAD svn://svnserver/FooProject/trunk .

Note the period at the end of the command, telling Subversion to merge these 
changes into the local working copy.

The Subversion book has some good information on this:

Chapter 4. Branching and Merging
Section 4. Common Use-Cases for Merging
http://svnbook.red-bean.com/en/1.1/ch04s04.html


Sean Laurent
------------------------------
Bakers trade bread recipes on a knead-to-know basis.
------------------------------

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org