Tue 12th May 2015 at 12:50

Subversion Repository Spring Cleaning

Following on from my last article, I have recently been working on migrating a repository from a contractor that contained multiple code bases for various system over to individual repositories for each system.

The contract has sent us a set of dump file generate by svnrdump, one for each system. The first task was to get the path's changed to reflect the new structure we required, but I was constantly hitting either a "File already exists error" or "path does not exist" error, which was kind of frustrating. This lead me to modify the paths contained in the dump files manually, as explained in Moving a subversion repository to a different address/server

Once I had managed to get each of the dump files into their own seperate repositories, I keep up against another issue. One of revision numbers and empty revisions. Because the contractor had placed all of our systems into a single repository, even though he had filtered each system into it's own dump file, it seems they have not stripped empty revisions and thus the revision number for each of the new repositories where the same and contain all the logs for all the repositories. Granted, they were empty, but the log lines still existed which would make life moving forward messy and confusing.

After some Googling, I found that I was not alone in my predicament and found a nice script called svndumpfilter2, although I actually download it from here. It is written in python and thus you will need to make sure you have python installed prior to try to use it.

With this script, it was fairy straight forward to import. I sure the following procedure could be simplified, but as I was only able work with the dump files I had been supplied, I found the follow the most straight forward:

 

  1. Download the svndumfilter2 and make it executable
  2. Create the initial repository
    svnadmin create /path/to/repository
  3. Import the original dump file
    svnadmin load /path/to/repository < original.dump
  4. Dump repository through the svndumpfilter2 script
    svnadmin dump /path/to/repository | path/to/svndumpfilter2 /path/to/repository trunk branches tags --renumber-revs --drop-empty-revs > filtered.dump
    Note: trunk, branches and tags are the root folders in this repository, so you will need to chenge this, although you might have success with --pattern="*"
  5. Rebuild the repository
    rm -fr /path/to/repository
    svnadmin create /path/to/repository
  6. Finally, load the filtered dump file
    svnadmin load /path/to/repository < filtered.dump

The repository should now exist with all redundant logs removed and the rev's re-indexed.

Hopefully this might save someone else some time and head scratching...

 

 

This site uses cookies, please read my cookie policy.