Open Source

CVS, SubVersion, Mercurial: control version software comparison


CVS is the ancestor of all the today’s fancy control version software: SVN, GIT, Bazaar, Mercurial, etc.

CVS is used with command line tool: “cvs”

CVS work with a “repository” this is specified with the command line switch “-d” or using the shell variable CVSROOT

The most common command are:

  • create a repository: cvs init
  • initial import: cvs import “$program_name” “$author_name” “$initial_tag”

example: cvs import helloworld agx 0.0.1-alpha

  • local checkout: cvs checkout
  • remote checkout: cvs login ; cvs get $module_name
  • commit: cvs commit
  • check what you changed: cvs status
  • add files: cvs add $file_names
  • post your changes: cvs commit
  • set a tag release: cvs tag $tag_name


SubVersion is an evolution of CVS to work better across multiple developers and with branches and tags.

CVS is a bit of pain when using multiple developers because you have to costantly lock and unlock the files you’re modifying or when you handling many tags and branches.

SubVersion provider more features then CVS at the cost of just learning a few more command line switches to work with revisions, tags and branches.

SubVersion is far better then CVS at handling binary files and to add, delete and move files inside the repository.

SubVersion usage is transparent: just replace “cvs” with “svn” and 99% of the usage is the same.


Mercurial introduce some new things that subversion and CVS does not have.

First of all the repository is stored withing a single folder called .hg withing the root of your project, so no more filesystem pollution of directory called .cvs or .svn everywhere around.

The real innovation of Mercurial is that all the checkout and commit operation are now local to your own copy of the repository. Indeed there are two new commands to syncronize your copy of the source with the rest of the world.

It seems working like it create a custom branch of the source for you whenever you pull them from the NET.

Also you can send you changes to other repository that can be the official project repository or to some other friends that is working on the project too.

Mercurial has got some bad review because of this because it breaks the paragdmi of “Release Often” of the Open Source community. In my opinion instead this is a great feature that allow people to work more relaxed on “trunk” revision without other people breaking your code every 2 minutes.

Like CVS and Subversion Mercurial work transparently, just change “cvs” or “svn” with the new command “hg” and 99% of the usage is the same.

There are two new functions:

  • checkout from the NET: cvs pull $repository_url
  • commit to the NET: cvs push $repository_url

TIPS: Format of the remote URL when using SSH

You should be a bit carefull when using SSH for cloning a remote URL since it requires an extra slash. The format is: hg clone ssh://user@server/path. But path is usually a full patch and not a relative path so basically you need a doubled slash like in this example: hg clone ssh://