I have Subversion Repository that holds various smaller projects lumped into one directory.
This is annoying if you want to work on such projects with GIT as Subversion front-end, or want to put that code on Github.
I Therefore needed a way to extract these directories from one Repository and dump them into a dedicated repo with a proper directory structure (trunk, branches, tags).
These are the steps needed for my
First Dump all of
/home/svn and extract the
svnadmin dump /home/svn | \ svndumpfilter include --drop-empty-revs \ --renumber-revs --skip-missing-merge-sources \ php/rssreader > rssreader.dump
--renumber-revs make sure that the dumps history
looks clean and doesn’t have all commits from the parent directories.
I then needed to edit the dump file and remove a
svn-sync revprop which
svnadmin load barf.
If you have Copied contents around in the source repository, you may need
to include the sources of these copies as well, and clean them up in the
svndumpfilter will complain that it can’t copy
the Source directory in such cases.
Create new Repo and the Basic Layout
We now need a new, empty repository
svnadmin create rssreader svn -m 'Initial Layout' \ mkdir file:///$PWD/rssreader/php \ file:///$PWD/rssreader/branches \ file:///$PWD/rssreader/tags
It is important that you create the directory structure as it was in the Source Repository.
For this example the code i wanted to export was located at
php/rssreader i thus needed to create the
php/ path in my destination
svnadmin load won’t do that.
Import the dump
Now just load the dump file into the repository with:
cat rssreader.dump | svnadmin load rssreader
Cleanup the final repo
svn mv -m 'Move to trunk' \ file:///$PWD/rssreader/php/rssreader \ file:///$PWD/rssreader/trunk svn rm -m 'Remove junk' file:///$PWD/rssreader/php
Finally clone it with git
Now i can go ahead and create a git clone of it:
# first create the authors file echo "claus = Claus Beerta " > ~/svnauthors # Now Clone git svn clone -A ~/svnauthors \ -s file:///home/claus/rssreader \ rssreader-git
(git doesn’t expand $PWD properly, so you need to give it the complete path. Wierd)
Now i can go ahead and hack at the clean repo, commit it to Git or my Private SVN Server.