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

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

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

Mike Harris
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: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

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

Josh Siegel

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: [hidden email]
> For additional commands, e-mail: [hidden email]
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

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

Greg Hudson
In reply to this post by Mike Harris
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: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

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

Dale Worley-2
In reply to this post by Josh Siegel
> From: Josh Siegel [mailto:[hidden email]]
>
> 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: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

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

Ben Collins-Sussman
In reply to this post by Josh Siegel

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: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

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

Mike Harris
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: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

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

kfogel
In reply to this post by Mike Harris
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 <[hidden email]> 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: [hidden email]
> For additional commands, e-mail: [hidden email]

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]