Create a repository with subversion
In my last article I illustrated how to install Enlightenment by checking out the most recent code from the Enlightenment Subversion Server (see "Installing Enlightenment E17 using subversion"). After that article I thought it would be a good follow up to illustrate how to create your own subversion repository.
Why? What can you use a subversion repository for? If you are collaborating on an application project in which multiple users need to be able to check in and check out your code, you will definitely want to use a solution such as subversion. There are other, interesting possibilities, for using subversion...such as a repository for documentation that is
In this process we are going to create a repository called myrepository and a project within that repository called "myproject". Â For simplicity sake we are going to house that repository in our ~/ directory. This is only used for simplicity (to avoid permissions issues). Once you have gained an understanding of how to work with subversion, we'll discuss creating repositories that can be accessed from without.
Here are the steps for creating your subversion repository.
Step 1: Install Subversion
Step 2: Create your repository
svnadmin create ~/repository
Step 3: Create project folders within ~/myrepository. Once you have created the directory structure, you can then move the pre-existing project files into the trunk folder. If this is a new project (that no work has been done) you can start saving your project files to the trunk folder. The folder structure needs to look like this:
- main folder - project
- sub folders - branches, tags, trunk
- trunk sub folders (holds various project folders)
Step 4: Create an svn user. This will be the user(s) that are allowed access to the project.  The first step is to edit the ~/myrepository/conf/svnserve.conf file and add the following to the end of the file:
anon-access = none
auth-access = write
password-db = passwd
The next step is to edit ~/myrepository/conf/passwd and add the following to the end of the file:
user = user password
Where user is the username and password is the password for the user.
Step 5: Now it's time to import your project. From within your ~/myrepository direcotory issue the command:
svn import project1/ svn+ssh://user@ADDRESS/home/USER/myproject/project1 -m "Original Commit"
Where ADDRESS is the location of the machine housing the repository and USER is the actual user name. NOTE: The above command is all one line. Â When that command runs successfully you will be prompted for the user password. Once you correctly enter the user password you will see scroll by a number of lines all beginning with "Adding". That tells you all of your project files/folders have been added.
Step 6: Start the daemon. In order for other uses to be able to access that repository you have to run the subversion daemon. To start this, issue the command:
svnserve -d
You can now check out and check in your project files on your svn repository.
Final thoughts
This has been a very basic introduction to setting up a subversion server. The next time around we are going to take this to the next level and set up a subversion server that others can check in and check out files.
Advertisement
I am not clear on how the initial structure is created, from both the article and from Simon Moon’s comment. Should there be special folders and files in there? What about the always-present .svn file? Or, is this the point when we just pretend like Subversion is out of the equation and we create the files that we want, such as images, html, code, etc?
http://svnbook.red-bean.com/ – The book is complete and correct.
1. Create a repository
$ svnadmin create /your/repo/home
2. Initial checkout
$ svn co file:///your/repo/home /your/working/directory
$ cd /your/working/directory
3. Create the intial structure
$ for d in branch tag trunk; do mkdir $d; done
$ svn add *
$ svn commit -m “Initial structure”
4. THEN decide how you want to host the repository (svnserve bare, svnserve over ssh, apache/svn/dav over http (read only), apache/svn/dav over https (read write)… etc
There are a lot of security implications that need to be considered… the SVN Book covers all of the details.