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

RE: Efficient way to create a new branch from an existing working copy

From: Johan Corveleyn <johan.corveleyn_at_uz.kuleuven.ac.be>
Date: Thu, 2 Jul 2009 09:43:06 +0200

> The typical way how we create a new branch from a trunk is by
> copying the
> trunk to a new branch on the server and then checkout the new
> branch to a
> local working copy.
> As this is a very common procedure, I was wondering if this can
> eventually
> also be done in a more efficient/fast way.
> Is there way to - instead of checking out the new working copy -
> physically
> duplicate the working copy and then somehow tell Subversion to take
> this new
> directory as the working copy on the server?

I think you're looking for "svn switch":
-------
$ svn help switch
switch (sw): Update the working copy to a different URL.
usage: 1. switch URL[@PEGREV] [PATH]
       2. switch --relocate FROM TO [PATH...]

  1. Update the working copy to mirror a new URL within the repository.
     This behavior is similar to 'svn update', and is the way to
     move a working copy to a branch or tag within the same repository.
     If specified, PEGREV determines in which revision the target is first
     looked up.
...
-------

So, suppose /path/to/wc-from-trunk is your trunk working copy, you might try the following scenario:
$ svn copy <url>/trunk <url>/branches/my-branch
$ cp -r /path/to/wc-from-trunk /path/to/wc-my-branch
$ svn switch <url>/branches/my-branch /path/to/wc-my-branch

Just be careful with local modifications or unversioned files that you still had laying around in your trunk WC (they will be copied to your new branch WC, so you'd carry them with you). Keep an eye on the output of the svn switch command to see if everything goes smoothly ...

Regards,
Johan

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

To unsubscribe from this discussion, e-mail: [users-unsubscribe_at_subversion.tigris.org].
Received on 2009-07-02 09:44:13 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.