Apache subversion is a software versioning and source control system distributed as a libre software under the apache license. Developers use subversion to maintain current and historical versions,archive old versions of files and directories, examine logs of how they have changed over time. Subversion can operate across networks, which allows it to be used by people on different computers.

Merits of VCS:

  • Enable developers to work simultaneously.
  • Collaboration-Overwriting avoided
  • Storing Versions-Maintain history of every version of everything.
  • Restoring and backup

Classification:

(1) Centralized Version control System

(2) Distributed Version control System

Terminologies:

The Repository:Its known as the heart of version control system. It’s the central place where developers store all their work and the place where history resides. This can be accessed over a network with repository acts as server and version control as client. The client can store and retrieve the changes from the repository.

Trunk : This is a directory where all the main and unique development happens and is usually used by developers to work on the project.

Tags : The tags directory is used to store important snapshots of the project. Tag operation allows to give user-friendly, meaningful names to specific version in the repository.

Branches: Branch operation creates another line of development. Here the development process fork off into two different directions or in different ways independently of each other.

Working Copy : The working copy is the initial file that the developer works on and is isolated from the rest of the team.

Commit Changes : Commit is a process of merging ,its storing changes from private workplace to a central server or repository. After committing, changes are made available to all the teams. Other developers can retrieve these changes by updating their working copy. Commit is an atomic operation. Either the whole commit succeeds or is rolled back. Users never see half finished commit.

SVN Installation

SVN is an open-source and available for free over the internet. It comes by default with most of the GNU/Linux distributions, so it might be already installed on your system. To check whether it is installed or not use following command:

>svn –version

If Subversion client is not installed, then the command will report error, otherwise it will display the version of the installed software.

 svn --version
-bash: svn: command not found

If you are using RPM-based GNU/Linux, then use yum command for installation. After successful installation, execute the svn –version command.

> su –

Password: 
[root@CentOS ~]# yum install subversion

[abc@CentOS ~]$ svn --version
svn, version 1.6.11 (r934486)
compiled Jun 23 2012, 00:44:03

And if you are using Debian-based GNU/Linux, then use apt command for installation.

[abc@Ubuntu]$ sudo apt-get update
[sudo] password for abc:

[abc@Ubuntu]$ sudo apt-get install subversion

[abc@Ubuntu]$ svn --version
svn, version 1.7.5 (r1336830)
compiled Jun 21 2013, 22:11:49




SVN LIFECYCLE

Creating a repository

The ‘create’ operation creates a new repository. Mostly it’s done only once. When new repository is created, name and location need to be mentioned.

Checkout

This operation is used to create a working copy of the repository. Necessary Changes are made and later on, submitted to the repository.

Update

The ‘update’ operation is used to update working copy. Synchronization takes place and the repository is shared by all the teams , the other developers can commit their changes and your working copy becomes older.

Let us suppose ABC and XYZ are the two developers working on a project. Both checks out the latest version from the repository and start working. At this point, their working copies are completely synchronize with the repository. XYZ completes his work very efficiently and commits his changes to the repository.

Now ABC’s working copy is out of date. Update operation will pull XYZ’s latest changes from the repository and will update ABC‘s working copy.

Rename/Move

One can add files/directories. But immediately these files/directories do not become a part of the repository, instead they are added to the pending change-list and become a part of the repository after the commit operation.

Similarly, one can delete files/directories. Delete operation immediately delete files from the working copy, but actual deletion of the file is added to the pending change-list and changes are made to the repository after the commit operation.

‘Rename’ operation changes the name of the file/directory. ‘Move’ operation is used to move files/directories from one place to another in a repository tree.

Review

All modifications to the working copy will get synchronized with the repository. The changes to the working copy becomes newer than the repository. So, reviewing the changes before making any changes is recommended.

The status operation shows the modifications that have been made to a working copy. When we make any changes to the working copy, all changes will be noted in the pending change list. We could list the changes with the ‘status’ operation. However, the status operation will only list the changes, but not the details about them. This can be viewed with the help of the ‘diff ‘operation.

Revert

Revert operation helps to revert working copy to normal state.It reverts back all changes made in the working copy. It will destroy the pending changing list and helps to get back working copy to its original state.

Resolve

Through ‘resolve’ operation, user informs ‘version control system’ about the ways of handling the conflicts which occured at the time of merging. The merge operation automatically handles everything that can be done safely.

Commit

Commit operation enables developer to apply changes from the working copy to the repository. This operation modifies the repository and other developers can view changes by updating their working copy.Before that ,file/directories need to be added to the pending change-list. This is a place where changes wait to be committed. Commit is an atomic operation so that either the entire commit succeeds or is rolled back.

Subversion’s Architecture

 

subversion

Subversion Components

svn

The command line client program

svnversion

This is a program for reporting the state

svnlook

A tool for directly inspecting a subversion directory

svnadmin

Tool for creating, tweaking or repairing a subversion repository

mod_dav_svn

Plug-in module for the apache http server, used to make your repository available to others over a network.

Svnserve

This is a custom standalone server program, runnable as demon process or invokable by SSH.

Svndumpfilter

Program for filtering subversion repository dump streams

svnsync

Program for incremently mirroring one repository to another over a network

svnrdump

A program for perfoming repository history dumps and loads over a network

Generally used SVN Commands

SVN checkout

Checkout command is used to download sources from SVN repository to the working copy. If you want to access files from the SVN server, checkout is the first operation you should perform.

SVN checkout creates the working copy from where you can edit, delete, or add contents. You can checkout a file, directory, trunk or whole project. To perform the checkout, you should know URL of the components you want to checkout.

>> svn checkout/co URL path

**URL is the components to checkout.

**If path os omitted, the basename of the URL will be sued as the destination. If multiple URLs are given each will be checked out into a subdirectory of path, with the name of the subdirectory being the basename of the URL.

Kindly note, when you do a checkout, it creates hidden directory named.svn, which will have the repository details.

SVN commit

Whenever you make changes to the working copy, it will not reflect in SVN server. To make the changes permanent, you need to do SVN commit.

>> svn commit -m “messages”

The reason for changing the file can be given in the -m option.

I’m briefing an example of this below. In a working copy the file named “svn-lifecycle” has the following content

>> cat /home/xyz/sv-lifecycle

checkout

update

perform changes

review changes

fix mistakes

resolve conflicts

commit changes

>>ls -l svn-lifecycle

l made a change by making the file empty. Now commit the file to make changes permanent in the server.

>> svn commit -m “making the file empty” svn-lifecycle

SVN List

Svn list is useful when you want to view the content of the SVN repository, without downloading a working copy.

>> svn list

When you execute svn list command with–verbose option, it displays the following information.

**Revision number of the last commit

**Author of the last commit

**Size

**Date and time of the last commit

SVN Add

When you need to add a new file to the repository, you need to use SVN add command. The repository will have newly added file, once we perform SVN commit.

Add the file in the SVN repository

>> svn add filename

Now, commit the added file. Until you commit, the added file will not be in the repository.

SVN Delete

This command helps to delete a file from the repository. Just like the add command, files will be deleted from the repository when you do an SVN commit.

>> svn delete URL

>> svn delete filename

>>svn commit -m “Removing the file” filename.

SVN Diff

This displays the differences between the working copy and the copy in the SVN repository.You can find the difference between two revisions and paths etc.

>>svn diff filename

svn -r R1:R2 diff filename

The above command compares the file name at R1 and filename at R2

SVN status

This is used to get the status of files in the working copy. It displays whether the working copy is modified, its been added/deleted or file is not under revision control etc.

>> svn status path

SVN Log

SVN remembers every change made to your files and directories. To know all the commits made on a file or directory, use SVN log command

>>svn log filename

The above command displays all the commits made on the particular file.

SVN Move

This command helps to move a file from one directory to another or renames the file. The file will be moved to your local machine immediately and the changes will take effect in the repository once the commit occurs.

>>svn move source destination

>> svn move filename1 filename2

Now the file is renamed only in the working copy, not in the repository. To make the changes permanent, you need to commit the changes.

Advantages of Subversion

  • The single revision number plays s vital role in making note of the updates made or the rebuild.
  • Subversion tracks revisions to the whole directory trees over time, which means files and directories are versioned.
  • Repository integrity is maintained, i.e; collection of updates either goes into the directory or it does not.
  • Files will be having set of properties, form of key value pairs. Users can add their of key values on behalf of their updates.
  • The range of tools in subversion helps the users to view the contents of the repository in various ways.
  • Recovery of data with the help of guaranteed auto-backup.

Disadvantages of Subversion

  • Subverions have the renaming facility only apparently.
  • Recurring cost, free and standard hosting service is still not available.
  • If we want to make a copy of the source code, we have to literally copy/paste it.
  • Locking mechanism is available only in the file level but not in the directory level.
  • This is not suitable for any any private purpose, such and manipulating any single file or directory
  • The file cannot be deleted from the database once it is added to the subversion. If we want to remove specific file and all the revisions, then it is not possible.

Similar tools like SVN

CVS : This is the primary one in version control systems. This is a simple system for making files and folders were kept up-to-date. The code base isn’t full featured as SVN or other similar tools. CVS works more slowly than SVN. CVS only allows to store files and nothing else where as SVN allows excellent functionality.

GIT : This is the new advanced version of version control systems which as more fast and reliable. GIT offers distributed version control system, where as SVN used centralized version control system. In fact, GIT is much faster than SVN. Being a distributed version control system GIT has its own advanced functionalities than SVN.

Mercurial : This is only another distributed version control system which is built in such way that it helps in larger projects. There aren’t some extra functions to learn as they are like the ones in other version control systems. This extremely faster than GIT and the creators have made this with performance as the primary concern.

Bazaar : This important feature of this tool is all about the access control over the setup. This can be suited for any scenario. This is very easy to modify, hence can be used nearly any project.

Libresource : This can be considered as a web portal used to manage n number of projects all together. This has very short cahnce of learning curve. It has built in features wiki pages, forums etc.

Monotone : This not quite popular as the other version control systems. This is quite easy to learn if we are familiar with other version control systems. This places higher value on integrity than performance.

Conclusion

Version control is a powerful tool for professional software development.In all ways apache subversion helps the developers to maintain their files, such as web pages, source code, etc. Subversion is not limited to team usage. However, as it is perfectly viable to install the Subversion server and clients on a single computer for one user.

This plays an integral part in maintaining the performance and keeping the work up to date. Subversion will act as the sole leader in the Standalone Software Configuration Management (SCM) category and as a strong performer in the Software Configuration and Change Management (SCCM) category.