Dr. Dobb's is part of the Informa Tech Division of Informa PLC

This site is operated by a business or businesses owned by Informa PLC and all copyright resides with them. Informa PLC's registered office is 5 Howick Place, London SW1P 1WG. Registered in England and Wales. Number 8860726.


Channels ▼
RSS

Open Source

Subversion and Linux: Setup and Use, Part 1


Ramanathan Muthaiah is Configuration Management Lead at Infineon Technologies India. Ramanathan has more than 10 years of experience in customer support, network and systems administration, and configuration management, and can be reached at [email protected].


The Subversion open source project has come a long way and achieved major milestones with many significant releases. To get an idea of the growth of Subversion as a mainstream version-control system, have a look at the testimonials and security space survey at subversion.tigris.org . Given the steady growth and adoption of Subversion by major players in the FLOSS world, it is imperative to understand the working nuances of this open source tool.

In the first installment of this two-part article, I provide an overview of Subversion design blocks and, to possible extent, addressed the details in setting up the basic system and using the same via the "file://" access scheme. In Part 2, I look at additional subcommands (e.g., svn propedit, svn merge, and others). Access to Subversion repositories via svnserve and http schemes as well as the availability of various third-party tools for Subversion will also be addressed in the second part.

Why Replace CVS?

The Concurrent Versioning System (CVS) uses RCS storage for its repository needs and can track changes or revisions to file contents but not directory trees. It does not have provisions (out of the box) to copy, move, or rename artifacts stored in the repository without losing their history. Also, the inefficient handling of repository transactions over the network and branching/tagging operations are some of the factors that influenced the Subversion project team to go about writing a replacement for CVS.

What's New in Subversion?

Subversion is released under an Apache/BSD-style open source license. Here are some of the major highlights in Subversion:

  • Atomic commits: With every commit to the repository, revisions and changes are committed either in full or none.
  • Directory and metadata versioning made possible with virtual versioned file system.
  • Advanced network layer: Subversion network server is Apache httpd and uses WebDAV as its network protocol.
  • Faster network access: Regardless of file type, a binary diff'ing algorithm is used to store and transmit deltas in both directions (i.e., from/to the repository and Working Copy (WC)).

The Tigris Web site provides the set of features in Subversion v1.4 series; at this writing, the latest release (stable) was v1.4.3.

Subversion Design

Briefly, I will cover the design of Subversion touching on its various layers. This layered architecture design (see Figure 1) is a significant improvement compared to the state-of-affairs in CVS.

[Click image to view at full size]
Figure 1: Subversion architecture. (Courtesy www.svnbook.red-bean.com.

File System Layer

Subversion repositories can be hosted using either FSFS or Berkeley DB. The following sections provide an overview of the two file systems.

Berkeley DB. From the Subversion design book:

When the initial design phase of Subversion was in progress, the developers decided to use Berkeley DB for a variety of reasons, including its open-source license, transaction support, reliability, performance, API simplicity, thread-safety, customer support and so on. ... But every rose has its thorn, and so we must note some known limitations of Berkeley DB. First, Berkeley DB environments are not portable. You cannot simply copy a Subversion repository that was created on a Unix system onto a Windows system and expect it to work. Secondly, Subversion uses Berkeley DB in a way that will not operate on Windows 95/98 systems -- if you need to house a repository on a Windows machine, stick with Windows 2000 or Windows XP. ... Finally, because Berkeley DB is directly linked into Subversion, it's more sensitive to interruptions than a typical relational database system.

FSFS. FSFS, another repository storage system, was introduced in mid-2004; it is a custom Unix-like file system but is not attached to the OS kernel like the ext2 and ext3 file systems. It doesn't use any database at all for its storage needs. The advantages of using an FSFS-type repository over the Berkeley DB are, portability across different operating systems, accessibility via networked file system, and less sensitive to crashes.

Apart from maintaining the revisions to file and directory contents, Subversion also keeps track of revisions to meta-data, known as "properties" (here again, user-defined metadata is not versioned).

Network/RA Layer

Sandwiched between the "Client Layer" and the "File System Layer", the repository access (RA) layer is responsible for handling requests from clients to access repositories via HTTP, SVN, or local. RA is implemented as an abstract API by both the DAV and local access RA libraries. With this modular design and library-based implementation, it is easier for third parties to develop GUI clients.

This article would be incomplete if I did not mention the use of Apache in Subversion. Here are some reasons why Apache was chosen:

  • Proven and stable
  • Open source
  • Platform support
  • Proxy and firewall support
  • Authentication mechanisms

Note: The marriage of Subversion with Apache enables access to the repository from anywhere outside the office network without the need for a fat/thin client but via a simple browser, like Mozilla FireFox, Konqueror, or other browser that you wish to use.

Client Layer

This layer provides most of the functionalities that are requested by users for all their work involving access to the various repositories. This set of libraries, together known as "Client Libraries", have provisions for the management of the WC, in terms of its administration, techniques, and methods (via API) of interacting with the repository and general client functions for those tasks that involve both the repository and the WC. For a detailed description of the libraries, refer to the Subversion site [4].

In upcoming sections, I shall step through the nitty-gritty of installation, configuration, and setup of Subversion using repositories based on the FSFS storage format. For the purpose of this article, the coverage is limited to these operating environments:

  • Fedora Core 5 running Kernel 2.16.15-2054_FC5
  • Subversion 1.4.3
  • Apache Httpd v2.2.3

Briefly, I shall cover the:

  • Setup of users and groups for repository access using either "file:" or "svn:" or "http" schemes
  • Customized installation of Subversion
  • Creation and setup of repository
  • Overview of basic tasks in Subversion

In the second part of this article, I shall cover the following topics:

  • Configuration of Subversion for svnserve and http access schemes
  • Working with properties in Subversion
  • General config files (in Subversion) and their needs
  • Third-party tools available for Subversion


Related Reading


More Insights






Currently we allow the following HTML tags in comments:

Single tags

These tags can be used alone and don't need an ending tag.

<br> Defines a single line break

<hr> Defines a horizontal line

Matching tags

These require an ending tag - e.g. <i>italic text</i>

<a> Defines an anchor

<b> Defines bold text

<big> Defines big text

<blockquote> Defines a long quotation

<caption> Defines a table caption

<cite> Defines a citation

<code> Defines computer code text

<em> Defines emphasized text

<fieldset> Defines a border around elements in a form

<h1> This is heading 1

<h2> This is heading 2

<h3> This is heading 3

<h4> This is heading 4

<h5> This is heading 5

<h6> This is heading 6

<i> Defines italic text

<p> Defines a paragraph

<pre> Defines preformatted text

<q> Defines a short quotation

<samp> Defines sample computer code text

<small> Defines small text

<span> Defines a section in a document

<s> Defines strikethrough text

<strike> Defines strikethrough text

<strong> Defines strong text

<sub> Defines subscripted text

<sup> Defines superscripted text

<u> Defines underlined text

Dr. Dobb's encourages readers to engage in spirited, healthy debate, including taking us to task. However, Dr. Dobb's moderates all comments posted to our site, and reserves the right to modify or remove any content that it determines to be derogatory, offensive, inflammatory, vulgar, irrelevant/off-topic, racist or obvious marketing or spam. Dr. Dobb's further reserves the right to disable the profile of any commenter participating in said activities.

 
Disqus Tips To upload an avatar photo, first complete your Disqus profile. | View the list of supported HTML tags you can use to style comments. | Please read our commenting policy.