next up previous contents
Next: A Short Session with Up: What is Subversion? Previous: What is Subversion?   Contents

The Concept of a Version Control System

Version control means management of different versions of the same piece of information. The information can vary from ordinary text files, configuration files, binary files or almost any artifact involved in the development of a software. The main idea is to associate a unique number to any set of change and increment this number for any subsequent change.

The version control systems ease the process of incrementing this number and provide features which can be separated in two broad categories: record keeping and restoring and collaborative work.

These features can include:

The Version Control Systems follow three broad models: Lock-Modify-Unlock, Copy-Modify-Merge and Distributed Version models.

In Lock-Modify-Unlock model only one person is allowed to change a file at a time in order to prevent conflicts. User A must lock a file before she can edit it and if she has locked it User B cannot lock it and therefore make changes to it. User B has to wait for User A to unlock it, before User B lock it for himself. This model really prevents conflicts in some cases, but opens some other problems. The first of them is that the two users may want edit one and the same file but different parts from it and their changes will not overlap. There is no need to wait for each other. The next issue is the users sometimes forget their locks, so an administrator has to release their locks, which causes delays. The third problem is best described with an example: if one of the users obtains a lock for a C header file and changes a function's parameters in it, and the other user has locked the C file implementing that function with the previous parameters, they are not into conflict according to the VCS, but they do introduce a conflict and their program will not compile.

The Copy-Modify-Merge model tries to alleviate these problems. All users has their own working private copy of the repository and they can modify them simultaneously. Then they submit their changes to the repository and it merges their changes into one final version. Now two users can edit one and the same file. If User A submit his changes first and then User B tries to submit the file, User B is informed that his copy of the file is out-of-date. User B has to merge the new changes from the repository to his working copy and usually the VCS client does the merge for him if the two set of changes are not in conflict. If they are, User B has to resolve the conflicts by manually choosing which changes should go into his copy and them send his copy to the repository.

In the Distributed Version model, every user has a working copy that include the complete repository. The changes are distributed by merging between repositories.

An example for Lock-Modify-Unlock system is IBM Clearcase. Subversion and CVS by default follow Copy-Modify-Merge model, but can lock files and git is based on Distributed Version model.


next up previous contents
Next: A Short Session with Up: What is Subversion? Previous: What is Subversion?   Contents
Ivan Ivanov 2008-04-21