Multiple projects and subversion
Now we have the subversion repository created and you can access the repository nice and securely using the SSH protocol (see Using SSH with svnserve).
So what happens when you want to run version control on another project?
Well, there are two routes you could take here.
Firstly, you can add multiple projects to an existing subversion repository. This technique is discussed here.
Secondly, you can create another repository and include the new project in that.
Like everything, there are advantages and disadvantages to both techniques. The first option, while perhaps the easiest to configure, does mean that all projects within that repository have the same permissions. However, if you wanted one of the projects to be hidden from users, thus having different permissions, you may want to set up multiple repositories. That option is discussed in the next article.
Adding a second project
So how do we go about adding another project to the existing repository?
Adding further projects is literally a repeat of the steps used with project1 (see introduction to subversion)
To keep with the naming convention, we'll call this project2 (sorry about the lack of imagination).
Note that I have created this project on the slice where the repository is located. You can, of course, create a new project and import it from your local workstation.
So to create project2:
cd ~ mkdir project2 touch project2/layout.txt
To add it to the existing repository:
svn import /home/demo/project2/ file:///home/demo/repository/project2/trunk -m "Initial import of project2"
The output of my import showed this:
Adding /home/demo/project2/layout.txt ... Committed revision 5.
Why would this be revision 5 when it is the first import of project 2? The answer is that the whole repository is versioned. It is version 5 of the repository, not of the individual projects.
Having said that, each file in the repository is individually versioned so it knows what file has been updated or added and what version it relates to. So, without over complicating the issue, individual files are versioned, but the import created revision 5 of the repository.
As with project1, delete the project2 folder as we no longer need the original:
rm -rf project2
Move into your 'work' directory and 'check out' project2:
cd work svn co file:///home/demo/repository/project2/trunk project2
The output on my slice was:
A project2/layout.txt Checked out revision 5.
As with the import shown above, don't forget you can checkout the files remotely using SSH like so:
You can also do this remotely like so :
svn co svn+ssh://126.96.36.1990/home/demo/repository/project1/trunk project1 ... svn co svn+ssh://188.8.131.520/home/demo/repository/project2/trunk project2
You may want to create a new tunnel configuration as outlined in the previous article but the process is exactly the same.
As both projects come under the same repository you can also use the existing project1ssh tunnel - perhaps rename it to 'repository1ssh' so it identifies the repository rather than a single project within the repository.
That's it. Have as many projects in your repository as you want.
The next article will look at creating and serving multiple repositories so each project is versioned separately and with different permissions.
© 2014 Rackspace US, Inc.
Except where otherwise noted, content on this site is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License
See license specifics and DISCLAIMER