Tag svn

Moving part of a Subversion repository

I keep everything in Subversion. Lecture notes, bits of writing, everything. Including bits of miscellaneous code, the prototypes of which sometimes blossom (or metastasize, depending on your point of view) into full-sized projects.

To this end, I have a “miscellaneous code” repo with subdirectories for each new thingy. Most of these are very small, but sometimes they get large or I might want them to become public, in which case I have to turn part of this repo into a whole new repo.

To do this, I need to:

  • dump the repository
  • filter the repository to include only the bit I want
  • change paths
  • populate a new repo with the new data
Let’s assume we have a local repository (the only kind you can dump) in svn/misc_code and we want to filter for our project barry. import the whole thing into a new repository as trunk.
First, we do steps one and two:

This will give you a huge file you can now perform step 3 on : editing the paths. In our case, we want to change everything that was in the node path barry to be in the node path trunk. Just open the file and do a global replace of

with

Now you can create the new repo and load the data into it:

Also, pretty much none of this will work with binary data because of the hell that is md5 checksums being screwed up. But for text-only repos, it should be fine.

Copyright © Found
Jim Finnis' personal blog

Built on Notes Blog Core
Powered by WordPress