Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Copy part of SVN repo to new repo?

Currently, I have a large SVN repository with a bunch of different projects within it, as follows:

/
 Project1/
          trunk/
          tags/
          branches/
 Project2/
          trunk/
          tags/
          branches/
 Project3/ 
          (etc...)

However, I'm now trying to break it up into separate repositories (for various reasons), and I would like the following for each project:

/
 trunk/
 tags/
 branches/

If possible, all history and externals should remain intact. However, I'm unsure if this can actually be done. I have seen several questions similar to this on SO but none entirely addresses the issue I have here. Basically I am trying to "pull out" a subdirectory and its entire contents with history from the old repository and plop the whole lot into its own (new) repository.

Am I asking the impossible?

like image 386
Mark Embling Avatar asked Jun 17 '09 20:06

Mark Embling


People also ask

How do I copy a folder from one directory to another in SVN?

The easiest way to copy files and folders from within a working copy is to use the right drag menu. When you right drag a file or folder from one working copy to another, or even within the same folder, a context menu appears when you release the mouse.

How do I copy an SVN repository to another SVN server?

You can migrate a repository using the svnadmin dump function. On the SVN server, type svnadmin dump /absolute/path/to/the/repo > /tmp/repo. svndump . This will export the entire repository to a text file in the system's temporary directory and name it "repo.

How do I clone a SVN repository?

# Clone a repo with standard SVN directory layout (like git clone): git svn clone http://svn.example.com/project --stdlayout --prefix svn/ # Or, if the repo uses a non-standard directory layout: git svn clone http://svn.example.com/project -T tr -b branch -t tag --prefix svn/ # View all branches and tags you have ...


2 Answers

Use

svnadmin dump path/to/repository > repo.dmp

and then use svndumpfilter to only load a subtree into a new repository.

like image 89
Stefan Avatar answered Sep 23 '22 14:09

Stefan


Since SVN 1.7 you could use

svnrdump dump path/to/repository > dump

to get the dump. While Stefans solution works, it does require access to the server hostig the repo. svnrdump works over the net with any repo you can read from.

like image 32
Tobias Kremer Avatar answered Sep 21 '22 14:09

Tobias Kremer