Login | Register   
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


advertisement
 

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

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.


advertisement
Wedging, Branching, and Tagging
Because it relies on the Berkeley DB filesystem as its standard repository storage backend, the repository occasionally will become "wedged". The Berkeley DB filesystem occasionally becomes wedged when it tries to perform a transaction but cannot because of a race condition occurring from simultaneous access. The Berkeley DB provides many important features—most notably database transaction semantics—but occasional wedging is one of its weaknesses. When that happens, further transactions are prevented and you cannot access the Subversion repository. Fortunately, wedging occurs infrequently and is also harmless as long as it is treated right after it happens. When it does, issue the following command to fix the problem:

svnadmin recover /path/to/repository

It is important to run the "svnadmin recover" command as the user who manages the repository (who may or may not be root). If you run it as a different user, you will need to change the permissions on the repository files afterwards to allow the Subversion users to access the repository. In order to prevent corruption of a wedged repository, Subversion will not allow you to use a repository that has become wedged.



The previously mentioned branching and tagging are easy to use in Subversion. In contrast to CVS, there are no special commands for dealing with branches or tags. Subversion treats them simply as other directories in the virtual filesystem that it creates in the repository. Taking the example of first-project with Car.java, Dealer.java, and Customer.java, you can issue the following command to create a branch:

svn copy file:///srv/svn/first-project-repository/trunk
file:///srv/svn/first-project-repository/branches/teds-branch

Now Ted can work on his branch and check in changes to his branch without affecting others working on the trunk. When he is ready to merge his changes back with the trunk, he issues the following command:

svn merge -r 101:HEAD file:///srv/svn/first-project-repository/trunk

Replace 101 with the revision as determined by the following command:

svn log —verbose —stop-on-copy
file:///srv/svn/first-project-repository/branches/teds-branch

Tags are the same as branches. You create a tag with a command similar to the following:

svn copy file:///srv/svn/first-project-repository/trunk
file:///srv/svn/first-project-repository/tags/release-2.2

The difference between a branch and a tag is purely user-defined. Subversion does not treat tags differently from branches. You may think of a tag as a snapshot of the code base at a given point in time. The only way in which tags are different from branches is that you (and other users) refrain from committing any changes to them. With the release-2.2 tag shown previously, you could always get access to the version of the code base used to build release 2.2 by simply checking it out as follows:

svn co file:///srv/svn/first-project-repository/tags/release-2.2 rel-2.2

Subversion Is Just Better
As this tutorial has demonstrated, Subversion is a highly useful tool that is superior to CVS. Whether you are beginning a new project or you have an old project that uses CVS, you should strongly consider using or switching to Subversion.



Wellie Chao has been active in the business of technology for many years, has been involved with software and hardware since 1984, and has been writing Web-based software in a variety of languages and on different platforms since 1994.
Comment and Contribute

 

 

 

 

 


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

 

 

Sitemap