Put your junk in the trunk: “Moving” a subversion repo into the trunk

This post gives you the Windoze commands because this was something I worked on for my Office.

We have a project.  Let’s call it project1.  When the repo for the project was initially created it was not created with branches, trunk, and tags folders in the root.  Going forward, everything was just committed to the root instead of to the trunk folder.  Well, now we want to follow best practices and begin committing to the trunk.  We don’t want to lose any of our repo history in the process though if we have to do re-creations of the repo.

We tried to do an svn mv, but you can’t move a repo to a path within the repo.  So here’s what we did.

  1. Make a dump of the current repo
    svnadmin dump c:\Repositories\myproject1\ > c:\myproject1.dump
  2. Delete  the current repo (I’m assuming you have a backup if something goes wrong.  You do, don’t you?).
    rmdir c:\svn\myproject1
  3. Recreate the repo.  This time let’s be sure to make branches, trunk, and tags folders in the root.
    svnadmin create c:\Repositories\myproject1
    svn mkdir trunk
    svn mkdir branches
    svn mkdir tags
  4. Load the dump into the trunk (Gross):
    svnadmin load c:\Repositories\myproject1\ --parent-dir trunk < c:\myproject1.dump

There it is.

You might also give this a try: http://chipcastle.blogspot.com/2008/08/subversion-forgot-to-create-trunk.html

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.