You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@subversion.apache.org by thibaut colar <tc...@colar.net> on 2009/04/01 17:44:04 UTC

Commit to a branch ?

Hello there, I have a subversion issue I'm not sure how to solve.

Here is the scenario:
3 different developers worked from a trunk copy(same) and made changes.
We now want to commit all this, but decided (after the fact, don't ask) 
to commit to a branch (created now from the trunk version we started the 
work on).

Basically I would like to commit the existing working copy changes to 
the branch but can't figure a way to do this (don't think there is a 
'copy to branch' feature)
- If we do a "switch copy" to switch to the branch that would loose the 
local working copy changes.
- If I do a 'svn copy' of the local working copy to the branch, I don't 
think that will work(copy wouldn't know to merge all 3 devs changes right ?)

I believe the proper thing to do is probably to merge the working copy 
of each dev to the branch(then switch to it), however i can't quite 
figure the magic incantation do do it

I expected something like this:
svn merge --dry-run -r 2125:HEAD . 
http://server/svn/branches/somebranch/project1

I first tried without the revision stuff because I use svn 1.5 and 
thought the new merging does not need it.

Anyway if anybody can shade any light, that would be nice.

Thanks.

------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=1065&dsMessageId=1509292

To unsubscribe from this discussion, e-mail: [users-unsubscribe@subversion.tigris.org].

Re: Commit to a branch ?

Posted by Ryan Schmidt <su...@ryandesign.com>.
On Apr 1, 2009, at 18:12, thibaut colar wrote:

> Sorry that was unclear, I meant we all have our own working copy.
> By "same", I meant to say there copies where "updated" at the same  
> time (started at same revision)
>
> So yeah then it should be easy, i'll just do the switch to branch,  
> followed by commit, update for each then,

Yes -- beginning with first creating the branch from the trunk  
revision. And depending on whether the developers have been editing  
the same parts of files, there may be some conflicts to resolve, but  
that would be no different than if they were committing to trunk.

> it's that message in Netbeans that was misleading, I was pretty  
> sure I did this in the past just fine.
>
> FYI, Here is what Netbeans shows(screenshot):
>
> http://wiki.colar.net/ 
> netbeans_silly_warning_when_doing_a_svn_switch_to_copy

I'm not familiar with Netbeans, but yes, that message does give one  
pause. You might want to ask the developers of Netbeans what they  
mean by it, and whether their software is just using "svn switch",  
which does not lose local modifications, or something else that does.

> Thanks

P.S: Don't forget to use Reply All so your reply goes to the list  
too, not just to me.

------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=1065&dsMessageId=1517072

To unsubscribe from this discussion, e-mail: [users-unsubscribe@subversion.tigris.org].

Re: Commit to a branch ?

Posted by Ryan Schmidt <su...@ryandesign.com>.
On Apr 1, 2009, at 12:44, thibaut colar wrote:

> 3 different developers worked from a trunk copy(same) and made  
> changes.

Here it sounds like you are saying three developers are sharing a  
single working copy of trunk and they are all making changes in it,  
which is of course not recommended.

> We now want to commit all this, but decided (after the fact, don't  
> ask)
> to commit to a branch (created now from the trunk version we  
> started the
> work on).
>
> Basically I would like to commit the existing working copy changes to
> the branch but can't figure a way to do this (don't think there is a
> 'copy to branch' feature)
> - If we do a "switch copy" to switch to the branch that would loose  
> the
> local working copy changes.
> - If I do a 'svn copy' of the local working copy to the branch, I  
> don't
> think that will work(copy wouldn't know to merge all 3 devs changes  
> right ?)

Here it sounds like you are saying each developer has his own working  
copy of trunk, which would be better.

The correct solution is to, totally separately from the work your  
three developers have done, make a branch, and then switch the  
working copy(ies) to it. Contrary to your supposition above, your  
local working copy changes will not be lost by doing this. Of course,  
please make backups of your working copy(ies) before following my  
instructions, in case I'm wrong.

The first step is to figure out at which point you would like to have  
made a branch. For example, suppose your developers checked out their  
working copy(ies) from trunk when it was at revision 100, and have  
now made local changes. In the mean time, other developers have made  
commits and now trunk is at revision 200, and you don't want to pull  
in these changes in your branch; you want to branch trunk at 100 and  
then commit your developers' changes to it.

You can make a branch from revision 100 of trunk like this:

export REPO=url://to/your/project
svn cp -r100 $REPO/trunk $REPO/branches/mybranch

Now, for each of your developers' working copies, switch it to that  
branch:

cd theworkingcopy
svn sw $REPO/branches/mybranch

Then check "svn di" to make sure the changes shown are still the  
changes that you intend to commit.

If each developer does have his own working copy, then this assumes  
that each developer checked out trunk from r100. If each developer  
checked out from a different revision of trunk, then you may need to  
do some more cleanup before committing.

> I believe the proper thing to do is probably to merge the working copy
> of each dev to the branch(then switch to it), however i can't quite
> figure the magic incantation do do it
>
> I expected something like this:
> svn merge --dry-run -r 2125:HEAD .
> http://server/svn/branches/somebranch/project1
>
> I first tried without the revision stuff because I use svn 1.5 and
> thought the new merging does not need it.

Merge only applies to things that have already been committed, and  
your post made it sound like your developers' changes were sitting in  
a working copy (or several working copies) and had not yet been  
committed. If I misunderstood, let us know so we can provide other  
recommendations.

------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=1065&dsMessageId=1511482

To unsubscribe from this discussion, e-mail: [users-unsubscribe@subversion.tigris.org].

Re: Commit to a branch ?

Posted by Daniel Becroft <dj...@gmail.com>.
Hi,

You should be able to create the branch, then 'svn switch' the working
copies to point to that branch without losing your local edits. We have used
this solution before as a method of 'shelving' incomplete or POC work.

Before we do the 'svn switch', we first update the working copy to be based
at the same revision as the source of the branch - not 100% sure of whether
this is necessary or not, but we've found it does eliminate many of the
issues.

For example, if HEAD is r100:

svn update  .......
Updated to r100.

svn copy /trunk /branches/new-branch  --> gives r101

svn switch ........
svn update .......
svn commit

Cheers,
Daniel B.

On Thu, Apr 2, 2009 at 3:44 AM, thibaut colar <tc...@colar.net>wrote:

> Hello there, I have a subversion issue I'm not sure how to solve.
>
> Here is the scenario:
> 3 different developers worked from a trunk copy(same) and made changes.
> We now want to commit all this, but decided (after the fact, don't ask)
> to commit to a branch (created now from the trunk version we started the
> work on).
>
> Basically I would like to commit the existing working copy changes to
> the branch but can't figure a way to do this (don't think there is a
> 'copy to branch' feature)
> - If we do a "switch copy" to switch to the branch that would loose the
> local working copy changes.
> - If I do a 'svn copy' of the local working copy to the branch, I don't
> think that will work(copy wouldn't know to merge all 3 devs changes right
> ?)
>
> I believe the proper thing to do is probably to merge the working copy
> of each dev to the branch(then switch to it), however i can't quite
> figure the magic incantation do do it
>
> I expected something like this:
> svn merge --dry-run -r 2125:HEAD .
> http://server/svn/branches/somebranch/project1
>
> I first tried without the revision stuff because I use svn 1.5 and
> thought the new merging does not need it.
>
> Anyway if anybody can shade any light, that would be nice.
>
> Thanks.
>
> ------------------------------------------------------
>
> http://subversion.tigris.org/ds/viewMessage.do?dsForumId=1065&dsMessageId=1509292
>
> To unsubscribe from this discussion, e-mail: [
> users-unsubscribe@subversion.tigris.org].
>



-- 
---
Daniel Becroft

------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=1065&dsMessageId=1511327

To unsubscribe from this discussion, e-mail: [users-unsubscribe@subversion.tigris.org].