Canarys | IT Services

Blogs

Subversion (Centralized Version Control System)

Share

Version control system is a repository of files, often the files for the source code of computer programs with monitored access. They are essential for any form of distributed, collaborative development. Whether it is the history of wiki page or the large program software firm.

Importance of version control systems:

  • Allow developers to work on the same software project simultaneously.
  • Archive every version including every change, deletion and addition that ever incorporated and happened during the project.
  • Minimize conflicts among developers who are working on the same project with the same code base.

 

Types of version control systems:

The following are the different types of the version control systems.

  1. Centralized version control systems
  2. Distributed version control systems

5

Note:

  • In Centralized server, to pull the code, checkout.
  • In Centralized server, to push the code, commit.
  • In Central version must work on online, in distributed have the flexibility to work offline.
  • Central version has the administrative capability over users.
  • Distributed version comparatively fast comparing to centralized version.

In this blog, we will concentrate only on the Centralized Version Control System and especially Subversion. Subversion falls under centralized version control system, meaning that it uses central server to store all files and enables team collaboration.

 

What is Subversion:

Subversion (SVN) is one of the most well-known centralized version control systems. In Subversion or SVN, you are checking out a single version of the repository. With SVN, your data is stored on a central server. Having the entire history on your local repository just means that even when you are not connected to the Internet, you can still do commits, diffs, logs, branches, merges, file annotations, etc. It allows to track changes and concurrent development on the same files by enabling the team collaboration.

 

Advantages of SVN:

SVN has one central repository – which makes it easier for managers to have more of a top down approach to control, security, permissions, mirrors and dumps. Additionally, many say SVN is easier to use than Git. For example, it is easier to create a new feature. With Git, it takes an extra step to create a new feature. Others say that the way SVN is set up results in greater trunk stability and having everything on a central server feels more controlled and secure for some. SVN allows developers to work simultaneously and do not overwrite each other’s changes by maintaining history of every version of everything.

 

VCS Terminologies: –

Let us start by discussing some of the terms that we will be using in this blog.

Repository:

  • A repository is the heart of any version control system. It is the central place to developers store all their work.
  • Repository not only stores files but also the history. Repository is accessed over a network acting as a server and version control tool acting as a client.
  • Clients can connect to the repository and then they can store or retrieve their changes to or from repository. By storing changes, a client makes these changes available to other people and by retrieving changes, a client takes other people's changes as a working copy.

Trunk:

This is a main development of the project. The trunk is a directory where all the main development happens and is usually checked out by developers to work on the project.

 

Tags:

These are further development under trunk. The tags directory is used to store named snapshots of the project. Tag operation allows to give descriptive and memorable names to specific version in the repository.

Branch:

Branch operation is used to create another line of development. It is useful when you want your development process to fork off into two different directions. For example, when you release version 5.0, you might want to create a branch so that development of 6.0 features can be kept separate from 5.0 bug-fixes.

6

Working copy:

Working copy is a snapshot of the repository. The repository is shared by all the teams, but people do not modify it directly. Instead each developer checks out the working copy. The working copy is a private workplace where developers can do their work remaining isolated from the rest of the team.

7

 

Commit changes:

Commit is a process of storing changes from private workplace to central server. After commit, changes are made available to all the team. 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.

 

Environment Setup:

The prerequisites for setting up the centralized version control system i.e. svn are as follows.

  1. SVN Server Manager (Server)
  2. SVN Client (this may be on any platforms like Windows, Linux).

 

Server Setup in Ubuntu:

The following are the steps to setup the server in the Linux Ubuntu operating system.

  1. Login as a normal user, and update ubuntu repositories.
sudo apt-get update
  1. Download apache 2 http server and SVN.
sudo apt-get install subversion apache2 libapache2-svn apache2-utils
  1. Make a folder for saving SVN repositories.
sudo mkdir -p /svn/
  1. Edit dav_svn.conf file
sudo vi /etc/apache2/mods-enabled/dav_svn.conf
  1. Setting file.
(location /svn) 
	DAV svn
	SVNParentPath /svn
	AuthType Basic
	AuthName “Subversion Repository”
	AuthUserFile /etc/subversion/passwd
	Require valid-user
(/location)

  1. Build account and password for SVN
sudo htpasswd -c /etc/subversion/passwd user1
sudo htpasswd -m /etc/subversion/passwd user2
*-c: create new passwd file, and use for 1st create username/password
*-m: it enables the MD5 encryption for passwords.
  1. Create SVN files for repository
sudo svnadmin create /svn/testrepo
  1. Set the permission to access those repositories.
sudo chown -R www-data:www-data /svn
  1. Restart Apache2 server.
sudo /etc/init.d/apache2 restart
  1. Check SVN is ready or not

URL: http://localhost/svn/[repository name]

Open the URL in your browser and enter the username / password you're just setting up.

That’s it! We have successfully installed the server and created the repository then allowed users to access. From now, they can perform all the supported operations to the repository.

Leave a Reply

Your email address will not be published. Required fields are marked *

Reach Us

With Canarys,
Let’s Plan. Grow. Strive. Succeed.