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

Re: Commit to a branch ?

From: Ryan Schmidt <subversion-2009a_at_ryandesign.com>
Date: Wed, 1 Apr 2009 17:56:38 -0500

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_at_subversion.tigris.org].
Received on 2009-04-02 00:57:39 CEST

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

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.