Friday, November 13, 2009

Move SVN project to a different repository

I had an SVN repository containing multiple projects in location "D:\svn":
D:\>svnlook tree svn -N
/
 TarantinoSamples/
 wilser/
 oscommercel/
 jarmel/
I needed to move my project "jarmel" to a totally different repository (at http://www.xp-dev.com/). How did I do that?
  1. Dumped the whole repository (containing all projects: TarantinoSamples, wilser, oscommercel, jarmel) into a file "svn.dump":
    D:\svnadmin dump svn > svn.dump
    
  2. Filtered the dump to include only the "jarmel" project.
    D:\svndumpfilter include jarmel < svn.dump > jarmel.dump
    
  3. Hand-edited the file jarmel.dump to remove the initial adding of root directory "jarmel":
    Node-path: jarmel
    Node-action: add
    Node-kind: dir
    Prop-content-length: 10
    Content-length: 10
    
    PROPS-END
    
    
    
    
  4. Hand-edited the file jarmel.dump to replace all paths "jarmel/x/y/z" with "x/y/z":
    Find: "Node-path: jarmel/"
    Replace with: "Node-path: "
    
    Find: "Node-copyfrom-path: jarmel/"
    Replace with: "Node-copyfrom-path: "
    
  5. Import the new repository into newly created directory "D:\svnjarmel":
    D:\>svnadmin load svnjarmel --ignore-uuid svnjarmel < jarmel.dump
    
http://svnbook.red-bean.com/nightly/en/svn.reposadmin.maint.html#svn.reposadmin.maint.migrate
http://svnbook.red-bean.com/nightly/en/svn.ref.html