Login | Register   
RSS Feed
Download our iPhone app
Browse DevX
Sign up for e-mail newsletters from DevX

By submitting your information, you agree that devx.com may send you DevX offers via email, phone and text message, as well as email offers about other products and services that DevX believes may be of interest to you. DevX will process your information in accordance with the Quinstreet Privacy Policy.


Subversion Delivers Version Control that CVS Can't : Page 2

Subversion is an open-source version control tool that is superior to CVS. Find out which CVS flaws Subversion rectifies, and see how easy it is to start using this highly useful tool.




Application Security Testing: An Integral Part of DevOps

Time to Operate on Your Repository
Now that the repository has been set up, you can operate on it. You will usually be in one of two situations after creating a Subversion repository:
  1. You have some code you want to put in the repository immediately.
  2. You are just beginning a project and have no code yet.

If you're in the first scenario, you can either import your code into the Subversion repository using the import command, or you can copy the existing code into your working copy (discussed in the next paragraph) and then add it to the repository with the "svn add" command (discussed in the upcoming "Subversion in the Development Process" section). This tutorial does not cover the import command, but you can find out more about it in the Subversion manual.

For now, assume you are starting from scratch. Now that you have created the repository, you need to check it out and create a working copy in which you can create and change files. The working copy is where you work on your files in isolation from other developers. Use the following command to check out your working copy:

svn checkout file:///srv/svn/first-project-repository first-project

This command checks out the first-project-repository and places it in a directory called first-project in the current directory. If you did not want the first-project directory in the current directory, you can simply move it to another location.

Note that there are three slashes after "file:". The first two slashes are part of the URL protocol identifier. The analogous situation with Web access is how Web site URLs always have "http://" in front of them (note the two slashes after the http). The third slash after "file://" is part of the path—in other words, the path is "/srv/svn/first-project-repository". Subversion supports several protocols in the standard distribution (see Table 1).

Protocol Description
file Direct access (local filesystem repository)
http Transport via WebDAV protocol on Apache server
http Transport via WebDAV using SSL to encrypt data
svn Transport via custom protocol with svnserve server
svn+ssh Transport via custom protocol with svnserve server, tunneled through ssh connection
Table 1. Protocols Supported in Standard Subversion Distribution

To access a Subversion repository on another machine, you must use one of the network protocols (http, https, svn, or svn+ssh). The easiest protocol to set up probably is svn+ssh, if you already have ssh access to the remote machine. In that case, you do not have to do anything further to set up remote access to the repository (apart from creating the repository with the svnadmin create command on the remote machine, of course).

Now that you have checked out a working copy of first-project, change into the first-project directory that you created by issuing the "svn checkout file:///srv/svn/first-project-repository first-project" command before. Issue the following commands:

svn mkdir branches svn mkdir tags svn mkdir trunk svn commit

The last command (the commit operation) will ask you to enter a log message. Just enter "started project", and then exit the editor. Subversion should check in your changes.

You might be wondering why you just created three directories. The accepted way of handling branches and tags in Subversion is through file and directory operations. CVS has a tag command (more accurately, the "cvs tag" command) that provides branch and tag functionality. In Subversion, the branch and tag functionality are implicit because you can create copies of files and directories and tell Subversion to remember that the copies are related to one another. In other words, you can create branches and tags by simply telling Subversion to copy the trunk directory to a new directory underneath either the branches directory or the tags directory. An upcoming section elaborates on branches and tags.

Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.



We have made updates to our Privacy Policy to reflect the implementation of the General Data Protection Regulation.
Thanks for your registration, follow us on our social networks to keep up-to-date