Migration from CVS to SVN is often described on the repository server side only. When migrating you would normally delete your CVS working copies and check out a fresh one from SVN. However in case of a live website you may not want to reinstall the entire working copy (including locally changed configuration files and unversioned files). Reinstalling the website may cost time, increase server load and cause website downtime.
To overcome this problem you can convert the working copy from a CVS working copy to an SVN working copy, by replacing the CVS meta data with SVN meta data directories in your working copy:
- First make sure your CVS version is up to date and SVN contains a 100% equal version of your code (this is very important!). You may accomplish this by exporting your CVS repository and importing it into an SVN branch.
- Checkout a fresh working copy out of SVN and delete all files from it, leaving only its directory structure and SVN meta data (.svn folders) intact.
- Copy the working copy you just created over your environment you want to switch.
- Remove all CVS meta data (CVS folders) from your environment.
- After the transition you can verify whether the migration was successful by issuing "svn status"
On Linux or other UNIX based systems you may accomplish this using the following commands (assuming your www folder contains the environment you want to switch):
CODE:
# Check out a temporary svn working copy
svn checkout http://svn.example.com/myrepo/trunk temp
# Delete all content except the directory structure and .svn folders
cd temp
find -type f|grep -v \.svn|xargs rm
cd ..
# Copy the .svn meta data to your www folder
cp -r temp/* www/
cp -r temp/.svn www/
# Remove the temporary svn working copy
rm -rf temp
# Remove all CVS meta data from the environment
cd www
find -name CVS|xargs rm -r
cd ..
After doing this you can verify the version control status of your working copy by issuing "svn status". Of course you should test this on your testing environment first to make sure this migration doesn't pose any unforeseen problems before you apply this on your live website.