CVS To SVN
Maybe there is a slick way to do this but for my purposes its quicker this way. I wanted each of my CVS modules to be its own SVN repo so I created a list of my modules and wrote a quick script to convert each one. To accomplish this I copied my CVS repository to my subversion server (which is fine since the main impetus for this was the CVS server's untimely demise).
After the script runs check the log. Each convert command should return 0 unless there is an error in which case you will probably get a return value of 255 (also known as -1 displayed as an 8-bit unsigned integer). Each convert command is a status of 'warning' when its really 'info' this stems for lazy programming but do check for 'errors' as they are legitimate problems.
import os
import logging
logging.basicConfig(filename='cvs2svn.log')
log = logging
################### Config Variables ###################
svn_repo = '/var/svn/repos'
cvs_repo = '$HOME/nemo/nervous-development'
################### Config Variables ###################
f = open('modules.txt')
modules = f.read()
f.close()
modules = modules.split('\n')
for mod in modules:
if mod is '':
log.warn('NULL module given, skipping')
continue
cmd = 'cvs2svn -s %s/%s %s/%s' \
% (svn_repo, mod, cvs_repo, mod)
try:
ret = os.system(cmd)
log.warn('Module %s returned %s from convert' % (mod, str(ret)))
except Exception, e:
log.error('Couldnt import %s: %s' % (mod, str(e)))
--
ChristopherPepe - 06 Mar 2008