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

Re: Question: Best way to create new branch after changes have already been made to trunk WC

From: Bob Proulx <bob_at_proulx.com>
Date: 2005-04-27 07:30:06 CEST

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.

There are always a zillion ways to do anything. But what I would do
in your case is this.

  1. Determine the revision you want to have on the trunk after you
     are have branched. Use svn log for this.

  2. Create a branch of the trunk as it is right now. All of the
     history will remain with the branch.
       svn cp svn://repos/trunk svn://repos/branch/mydevbranch
     Note in the log message the actual base of the trunk. Because
     --stop-on-copy will stop at this revision and not the "real"
     place of the branch. So leave a trail behind to follow.

  3. Restore the trunk to the previous condition before the point
     where you wanted to branch. Use 'merge' for this.
       svn merge -rHEAD:REV svn://repos/trunk
       svn commit

Read the book on undoing changes. Here is the section.

  http://svnbook.red-bean.com/en/1.1/ch04s04.html#svn-ch-4-sect-4.2

> 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

That is basically exactly what you want to do and is what my example
above does. The 'merge' to undo the change is just one way to do that
programatically.

Bob

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org
Received on Wed Apr 27 07:32:54 2005

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.