1000 Miles or Bust!

Take a Hike…

Cute SVN tricks

Best procedure for importing an existing project into a new svn repository

This is the best procedure I’ve seen for importing an existing project into SVN. We first create a new svn repository (I prefer to use FSFS instead of BDB). Then we make an empty new directory inside that repository and checkout the empty working copy into the project’s root directory. An “add *” will then add everything into the project, and then a long initial commit imports the project into the new svn repository’s directory.  The killer feature is that this turns your existing code into a working copy.

svnadmin create --fs-type=fsfs /home/username/repos/projectname
svn mkdir file:///home/username/repos/projectname/project-root-dir -m "Make a directory in the repository to correspond to /project-root-dir"
cd /project-root-dir
svn checkout file:////repos/projectname/oproject-root-dir .
svn add *
svn commit -m "Initial version of projectname"

Removing all the SVN subdirectories in one bash command line

SVN’s most kludgey feature is that it uses multiple .svn directories inside every subdirectory in your project.  This makes it quite difficult to remove a copy from version control by deleting all the .svn subdirectories, particularly in a  large and complex project.  Very uncool compared to say, mercurial, which sensibly puts all its files inside one .hg directory tree at the project’s root level.

So here is a unix command to remove all the .svn directories from version control:

rm -rf `find . -name .svn`

Use FSFS instead of Berkeley DB

Another somewhat kludgey feature of svn is that it uses an antiquated db to store its files. But if you specify a FSFS repository in your create command, you can create your repository using the FSFS filesystem. FSFS  has two killer features–your svn repo will be portable without doing a database dump, and it makes backups simpler and more reliable.

svnadmin create --fs-type=fsfs /home/username/repos/projectname

Useful reference links

August 20th, 2008 Posted by Tim | Hacking | no comments

No Comments »

No comments yet.

Leave a comment

You must be logged in to post a comment.