Importing history into Subversion

With existing SVN history

For Savannah administrators: here's how to import an SVN repository.

Make sure that SVN is already enabled for the project (under Main -> Administer -> Select Features). This will create the svn repository with the correct ownership and permissions.

The project developers need to create an SVN dump as explained at SvnImportExistingRepo.

Once the user has provided it, login at Savannah, then use this recipe as a guideline to import the project.

ssh vcs
screen # or whatever, see below
cd /root/vcs-imports
proj=THEIRPROJECT
# get their dump file, e.g.:
dumpfile=$proj-dump.bz2
#scp dl.sv.gnu.org:/srv/download/$proj/$dumpfile .
# or whatever they give, e.g.,
#wget http://url/to/$dumpfile
bzcat $dumpfile | nice svnadmin load /srv/svn/$proj/ >/tmp/$proj.svimport.out 2>/tmp/$proj.svimport.err
tail /tmp/$proj.svimport.err
tail /tmp/$proj.svimport.out
rm $dumpfile

Sometimes we may be given a tar of their svn repository. In this case, we must ask for a proper svn dump (produced by svnadmin dump). Using a direct tar is not safe because we may not be using the same versions of SVN, and sometimes the format changes with the new versions of SVN.

The svnadmin load is machine intensive and time consuming; it can easily take several seconds per revision. Meaning that this import might easily take several hours to load on a project with any significant history. Planning accordingly by running the task under a screen session, or using nohup, or some such, so that it can complete even if your connection to it is dropped is a good idea.

If converting from another version control system on Savannah then as a final step the prior system should be disabled to prevent further commit access there, see for example CvsDisabling.

Manually creating a Subversion repository

If as a root admin you manually create a Subversion repository then the files will be set to user:group root:root and the permissions will be restricted by the root umask 022. These will need to be converted to the project group and permissions.

proj=THEIRPROJECT
svnadmin create /srv/svn/$proj
find /srv/svn/$proj/db -type d -exec chmod g+ws {} +
find /srv/svn/$proj/db -type d -exec chgrp $proj {} +
find /srv/svn/$proj/db -type f -exec chgrp $proj {} +

In particular, be sure to leave the hooks directory (along with the others) owned by root:root and with secure permissions only for the root user.

These steps are all done automatically when the repository is created through the project web interface.