You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by Mike Harris <GE...@prodigy.net> on 2005/04/26 16:10:09 UTC

Question: Best way to branch after changes have already been made

Here's my situation.  I have made changes to my working copy of our 
trunk.  After making a week's worth of changes, I now need to shelve the 
changes and move on to something else.  What I want to do is check these 
changes into a branch, but my working copy points to the trunk.  What is 
the best way to accomplish this?  There are a couple ways I know of to 
do it, but they seem sub-optimal.

1. I could create the branch of trunk, check out a working copy, then 
copy the modified files into the branch working copy and check it in

2. I don't think this even works, but I could relocate (switch 
--relocate) my WC from trunk to the new branch and check in.  This would 
be great, but I don't believe relocate can be used in this fashion.

Any suggestions would be appreciated.  Thank you.

Mike Harris

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

Re: Question: Best way to branch after changes have already been made

Posted by kf...@collab.net.
In the future, please ask questions like this on the users@ list, not
the dev@ list.  The dev@ list is for development discussion, not user
support.  

(Not a big deal, just letting you know for next time.)

Thanks,
-Karl

Mike Harris <GE...@prodigy.net> writes:
> Here's my situation.  I have made changes to my working copy of our
> trunk.  After making a week's worth of changes, I now need to shelve
> the changes and move on to something else.  What I want to do is check
> these changes into a branch, but my working copy points to the trunk.
> What is the best way to accomplish this?  There are a couple ways I
> know of to do it, but they seem sub-optimal.
> 
> 1. I could create the branch of trunk, check out a working copy, then
> copy the modified files into the branch working copy and check it in
> 
> 2. I don't think this even works, but I could relocate (switch
> --relocate) my WC from trunk to the new branch and check in.  This
> would be great, but I don't believe relocate can be used in this
> fashion.
> 
> Any suggestions would be appreciated.  Thank you.
> 
> Mike Harris
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
> For additional commands, e-mail: dev-help@subversion.tigris.org

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

Re: Question: Best way to branch after changes have already been made

Posted by Mike Harris <GE...@prodigy.net>.
Ben Collins-Sussman wrote:

>
> On Apr 26, 2005, at 12:19 PM, Josh Siegel wrote:
>
>>
>> You can copy directly from your working area to a branch and it will 
>> "do the right thing" including grabbing all your local mods
>>
>> go to the root and do a
>>
>> "svn copy . http://foo/branches/shelf"
>>
>
> Nothing so complex is needed:
>
> Create the branch:
>
>    'svn cp trunkURL branchURL'
>
> Then switch your working copy to it:
>
>    'svn switch branchURL'
>
> Your local mods will be preserved.  When you 'svn commit', all changes 
> will go to the branch.
>
> This very example is discussed in chapter 4, in fact.
>
>
Thank you very much, I did not realize switch behaved this way.  I have 
read that part of the SVN Book, and had not interpreted it as saying 
that switch will preserve local mods.  Makes things a great deal 
easier.  Thanks again. 

P.S. I apologize for posting to Dev.  I accidentaly copied the wrong 
e-mail address ..... and I guess I aplogize for AGAIN posting to Dev, 
but this seems to be where discussion has occured (I posted to users 5 
minutes after my original posting to Dev). 

Mike Harris

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

Re: Question: Best way to branch after changes have already been made

Posted by Ben Collins-Sussman <su...@collab.net>.
On Apr 26, 2005, at 12:19 PM, Josh Siegel wrote:

>
> You can copy directly from your working area to a branch and it will 
> "do the right thing" including grabbing all your local mods
>
> go to the root and do a
>
> "svn copy . http://foo/branches/shelf"
>

Nothing so complex is needed:

Create the branch:

    'svn cp trunkURL branchURL'

Then switch your working copy to it:

    'svn switch branchURL'

Your local mods will be preserved.  When you 'svn commit', all changes 
will go to the branch.

This very example is discussed in chapter 4, in fact.


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

RE: Question: Best way to branch after changes have already been made

Posted by Dale Worley <dw...@pingtel.com>.
> From: Josh Siegel [mailto:joshs@stormbirds.org]
>
> You can copy directly from your working area to a branch and
> it will "do
> the right thing" including grabbing all your local mods
>
> go to the root and do a
>
> "svn copy . http://foo/branches/shelf"

If I understand this correctly, it will leave the BASE of the WC as the
trunk, which means that to avoid checking these changes in to the trunk, he
should then either delete the WC or "svn switch http://foo/branches/shelf
.".

Dale


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

Re: Question: Best way to branch after changes have already been made

Posted by Josh Siegel <jo...@stormbirds.org>.
You can copy directly from your working area to a branch and it will "do 
the right thing" including grabbing all your local mods

go to the root and do a

"svn copy . http://foo/branches/shelf"

    -josh


Mike Harris wrote:

> Here's my situation.  I have made changes to my working copy of our 
> trunk.  After making a week's worth of changes, I now need to shelve 
> the changes and move on to something else.  What I want to do is check 
> these changes into a branch, but my working copy points to the trunk.  
> What is the best way to accomplish this?  There are a couple ways I 
> know of to do it, but they seem sub-optimal.
>
> 1. I could create the branch of trunk, check out a working copy, then 
> copy the modified files into the branch working copy and check it in
>
> 2. I don't think this even works, but I could relocate (switch 
> --relocate) my WC from trunk to the new branch and check in.  This 
> would be great, but I don't believe relocate can be used in this fashion.
>
> Any suggestions would be appreciated.  Thank you.
>
> Mike Harris
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
> For additional commands, e-mail: dev-help@subversion.tigris.org
>

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

Re: Question: Best way to branch after changes have already been made

Posted by Greg Hudson <gh...@MIT.EDU>.
On Tue, 2005-04-26 at 12:10, Mike Harris wrote:
> 2. I don't think this even works, but I could relocate (switch 
> --relocate) my WC from trunk to the new branch and check in.  This would 
> be great, but I don't believe relocate can be used in this fashion.

"svn switch --relocate" is *only* for the case where the way you access
your repository has changed.  It is not for moving around within a
repository; trying to use it for that purpose will break your working
copy.  Some day we hope to have a unified switch operation which handles
both cases and is safe, but right now you have to be very careful to
only use "svn switch --relocate" for its intended purpose and to give it
correct arguments.

I think a regular "svn switch" to the new branch would work fine, but
Josh Siegel's answer (using "svn cp" to copy your working copy to a new
branch) is superior.


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

Re: Question: Best way to branch after changes have already been made

Posted by Mark Phippard <Ma...@softlanding.com>.
Mike Harris <GE...@prodigy.net> wrote on 04/26/2005 12:10:09 PM:

> Here's my situation.  I have made changes to my working copy of our 
> trunk.  After making a week's worth of changes, I now need to shelve the 

> changes and move on to something else.  What I want to do is check these 

> changes into a branch, but my working copy points to the trunk.  What is 

> the best way to accomplish this?  There are a couple ways I know of to 
> do it, but they seem sub-optimal.
> 
> 1. I could create the branch of trunk, check out a working copy, then 
> copy the modified files into the branch working copy and check it in
> 
> 2. I don't think this even works, but I could relocate (switch 
> --relocate) my WC from trunk to the new branch and check in.  This would 

> be great, but I don't believe relocate can be used in this fashion.
> 
> Any suggestions would be appreciated.  Thank you.

This should have gone to the users@ list, it isn't a dev question.

I think you can just do:

svn copy WC URL

To create a branch from your WC.  I think that will also put your changes 
on the branch you created.  If it doesn't, then just follow that command 
with these commands:

svn switch URL

svn commit

Note that you do NOT want to use --relocate on the switch command.  That 
option is reserved solely for the case where the root URL of your 
repository changes, such as when you move to a new server.  Otherwise, the 
svn switch command without that option is meant for what you are doing, to 
"cheaply" switch your WC so that it is working on a different location in 
the repository.

Mark



_____________________________________________________________________________
Scanned for SoftLanding Systems, Inc. by IBM Email Security Management Services powered by MessageLabs. 
_____________________________________________________________________________

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