Revision control system tutorial

The educational technology and digital learning wiki
Jump to navigation Jump to search

<pageby nominor="false" comments="false"/>

Introduction

Revision control system (RCS) or Version control system (VCS) or Source code management (SCM) stands for systems that allow software developers to manage application source code, including its various revisions. It also allows users to download various versions.

Learning goals
  • Be able to download software from CVS and SVN revision control systems, provided that you will find a correct CVS or SVN "string" on some download page
Prerequisites
  • Be able to use command line tools
Moving on
  • Follow up the links below.
Level and target population
  • Beginners
Quality
  • low (there be some mistakes too), but you it should get you going...
To do
  • Add an explanation on how to use 1-2 GUI tools
Purpose of source control


Sometimes we call it "version control". Sometimes we call it "SCM", which stands for either "software configuration management" or "source code management". Sometimes we call it "source control". [...] By any of these names, source control is an important practice for any software development team. The most basic element in software development is our source code. A source control tool offers a system for managing this source code.

There are many source control tools, and they are all different. However, regardless of which tool you use, it is likely that your source control tool provides some or all of the following basic features:

  • It provides a place to store your source code.
  • It provides a historical record of what you have done over time.
  • It can provide a way for developers to work on separate tasks in parallel, merging their efforts later.
  • It can provide a way for developers to work together without getting in each others' way.
Source Control HOWTO, retrieved 18:50, 15 October 2008 (UTC)


Revision control (also known as version control (system) (VCS), source control or (source) code management (SCM)) is the management of multiple revisions of the same unit of information. It is most commonly used in engineering and software development to manage ongoing development of digital documents like application source code, art resources such as blueprints or electronic models, and other projects that may be worked on by a team of people.

Changes to these documents are usually identified by incrementing an associated number or letter code, termed the "revision number", "revision level", or simply "revision" and associated historically with the person making the change. A simple form of revision control, for example, has the initial issue of a drawing assigned the revision number "1". When the first change is made, the revision number is incremented to "2" and so on.

(Wikipedia, retrieved 18:50, 15 October 2008 (UTC))
Popular open source systems
  • CVS. There exist several variants of this software. It was once upon a time the most popular system and therefore still being used.
  • Subversion. Subversion was designed as a CVS replacement and is todays (2008) most popular system in the open source community.

Installing a client

In order to use a RCS, you need to install some software on your computer. There exist several sorts of programs:

  • Command line tools (I find them most practical for just checking out something, since I usually download files from a repository directly to a server machine).
  • Extensions for IDEs and text editors.
  • Stand-alone GUI programs.
    • Tortoise SVN is the most popular Windows client. It is integrated with the file explorer.
    • An other good stand-alone Subversion client is eSvn

CVS command-line client

The program is called cvs. If it is not already on your system, install it. In Ubuntu Linux (and other Debian-based systems) type:

sudo apt-get install cvs

Subversion command-line client

The program is called svn. To install it under Ubuntu, type:

sudo apt-get install subversion


How to get software from CVS

Checking out software with the command-line client

The command line client is called cvs and you will use the checkout (aka co) command.

Most simple version
cvs checkout CVS_REPOSITORY_STRING
cvs co CVS_REPOSITORY_STRING
Using a repository - the methods

There exist several ways to get files from a repository on the Internet. The general syntax for a CVS_REPOSITORY_STRING is:

cvs checkout :METHOD:USER@HOSTNAME:PATH_TO_REPOSITORY

The following means to use rsh, ssh etc. to get the file through user "anonymous"

:ext:anoymous@test.org:/software/thething

The following will use a password authentication server through user "anonymous"

:pserver:anonymous@test.org:/software/thething

In other words, this cvs repository string contains several informations:

  • host: e.g. test.org
  • repository path: e.g."/software/thething"
  • user: e.g. "anonymous"
  • connection type: e.g. pserver
  • port: default (2401)
Checking out a file from a repository

Here is an example from the Mozilla organization

First you will have to login:

cvs -d :pserver:anonymous@cvs-mirror.mozilla.org:/www login

Hit return when it will ask for a password.

Then you can check out something, e.g.

cvs -d :pserver:anonymous@cvs-mirror.mozilla.org:/www -z3 co mozilla-org/html/quality/networking

The "-z3" just means that files should be compressed/decompressed in the transfer, i.g. you gain some download speed.

Instead of using the -d :pserver:anonymous@cvs-mirror.mozilla.org:/www argument you also may set the $CVSROOT variable. (Read Environment variable for a how-to).

How to get software from Subversion (SVN)

Subversion protocols

Subversion can be accessed trough several protocols:

  • http://
  • https://
  • svn://
  • svn+ssh://
  • file:///
  • svn+XXX://

The downloading instructions should tell you which one to use.

Checking out software with the command line tool

Open a terminal window. Then use the svn command.

In the most simple case, you will simply have to replace "URL" by the URL that you will find in the downloads instructions.

svn checkout URL
svn co URL (short version)
Example - Mediawiki software

To get the mediawiki software, you need a URL like this (as is it won't work).

svn checkout http://svn.wikimedia.org/svnroot/mediawiki/folders_to_download sub_folder_name

E.g. to download version 13 (oct 2008), you will have to type:

svn checkout http://svn.wikimedia.org/svnroot/mediawiki/branches/REL1_13/phase3

To download the development version:

svn checkout http://svn.wikimedia.org/svnroot/mediawiki/trunk/phase3

Of course, to install a new MediaWiki version, you usually would just download an *.gz archive. But extensions (and there lots of them) are often available through the MediaWiki subversion archive. It's simpler to use subversion than saving each file individually from the web interface.

To view extension code through the web:

To check it out, type in your terminal:

svn checkout http://svn.wikimedia.org/svnroot/mediawiki/trunk/extensions/NewsChannel/

The result will be 4 files in the NewsChannel directory (faster isn't it ?)

Putting files in a different directory

If you don't want to cd to a given directory, you also can add a path:

svn checkout http://svn.wikimedia.org/svnroot/mediawiki/trunk/extensions/NewsChannel/ /src/NewsChannel

Information with the command line tool

The info command will provide you with some information, e.g. try:

 svn info http://svn.wikimedia.org/svnroot/mediawiki/trunk/extensions/
 svn info http://svn.wikimedia.org/svnroot/mediawiki/trunk/extensions/NewsChannel
 svn info http://svn.wikimedia.org/svnroot/mediawiki/trunk/extensions/NewsChannel --recursive

Getting help with the command line tool

Besides reading various tutorials, you also may type:

svn --help

or for a specific topic, e.g.

svn --help checkout
svn --help co

Authentication

Some repositories don't want anonymous users to check out files. In this case, you need a user name and maybe a password.

svn checkout URL --username USER --password PASS

How to get software from GIT

GIT is the newest kid on the block.

“Git is a distributed revision control system with an emphasis on speed. Git was initially designed and developed by Linus Torvalds for Linux kernel development. Every Git working directory is a full-fledged repository with complete history and full revision tracking capabilities, not dependent on network access or a central server.”(Wikipedia, retrieved 14:33, 30 August 2010 (UTC))

“Repositories can be published via HTTP, FTP, rsync, or a Git protocol over either a plain socket or ssh. Git also has a CVS server emulation, which enables the use of existing CVS clients and IDE plugins to access Git repositories. Subversion and svk repositories can be used directly with git-svn.”(Wikipedia, retrieved 14:33, 30 August 2010 (UTC))

Typical download command

git clone git://URL/branch

Example (Mwlib software from PediaPress)

git clone git://code.pediapress.com/mwlib

Links

Overviews

Short Tutorials

Subversion
CVS
GIT

Example instructions for download

SVN
CVS
GIT

On-line books

Short manuals / cheat sheets

SVN
GIT

Software links

List of RCS systems
Lists of clients
CVS
Subversion

Tutorials for revision control system administrators

(In case you plan to have your own ...)