If you are lost on how to setup a subversion repository, this quick how-to may help. This can be used to setup a repository when you have existing files that you want to initially import into the repository (such as an existing project that is not under version control).
First you must create a repository. I like to create a repository for each project in the root directory of that project. For example, I am creating a repository for NutrientNet’s Kalamazoo project. The root directory of this project is /home/nutrientnet/kalamazoo. I will execute the following command to create the repository:
$ svnadmin create /home/nutrientnet/kalamazoo/svn_reposI like to call all of my repository directories ‘svn_repos’ for consistency.
Now that the repository is created, I can import the files that I want my repository to contain. There are many ways to do this, but I will describe the most simple here. First let me digress into the subject of repository layout.
Repository layout: Generally, I like to use a repository layout with three directories (within the repository), /trunk, /branches and /tags. /trunk has the main line of development for the repository. /branches has any branches that have been created (separate lines of development), and /tags contains special code for the repository actions (I rarely use this now). To create these directories, you can either use the command line, or use TortoiseSVN (the windows gui for administering the repository). Another way to do it is to create a temporary directory for importing your files. I’ll describe that below.
Here is a sample of the code you might use to accomplish this (continuing with my NutrientNet/Kalamazoo example):
$ cd /home/nutrientnet/kalamazoo
$ mkdir tmp
$ cd tmp
$ mkdir trunk
$ mkdir branches
$ mkdir tags
$ cp -R /home/nutrientnet/kalamazoo/dev/code/* trunk/
$ svn import . file:///home/nutrientnet/kalamazoo/svn_repos –message ‘Initial Repository Import’Don't forget the '.' after the svn import command. This tells svn to import everything in the current working directory.
Now you can use TortoiseSVN or another client to check out a working copy of the repository for modification.
Happy coding!