Version Control
Overview
Most software has a typical lifecycle: requirements analysis, design, code, test, release, repeat. There are two issues with this process. First, developers need to keep writing new features while quality-assurance teams take time to test supposedly-stable versions of the software. New work cannot halt while the software is tested. Second, the team almost always needs to support older, released versions of software; if a bug is discovered in the latest code, it most likely exists in released versions as well, and customers will want to get that bugfix without having to wait for a major new release.
Here's where version control can help. The core mission of a
version control system is to enable
collaborative editing and sharing of data (i.e. code files). Version control systems manage files and directories, and the
changes made to them, over time. This allows you (and perhaps others in your team) to recover
older versions of your files, or examine the history of how your
files changed. In this regard, many people think of a version
control system as a sort of “time machine”.
Subversion is one popular free/open-source version control system that is used widely in industry. Subversion can operate standalone on a single computer, or across networks, which allows people on different computers to use it to manage common files. At some level, the
ability for various people to modify and manage the same files from their respective locations fosters collaboration.
Progress can occur more quickly without a single conduit through
which all modifications must occur. And because the work is
versioned, you need not fear that quality is the trade-off for
losing that conduit—if some incorrect change is made to
the files, just undo that change.
Subversion is a centralized system for sharing information.
At its core is a
repository, which is a central store of files, usually maintained on a server computer.
The repository stores information in the form of a
filesystem tree —a typical hierarchy
of files and directories. For SE2030, the Subversion repository resides on emerald.msoe.edu (which in case you are wondering, is an HP
Proliant DL360 server running Debian Linux managed by CCSD). Using a Subversion
client
application on your PC, you can access the repository from your laptop. Any number of
clients connect (perhaps simultaneously) to the repository, and
then read or write to these files. There are various Subversion client applications available. The one you'll use in SE2030 is called
TortoiseSVN, which you can download and install by following the link.
By writing data, a client
makes the information available to others; by reading data, the
client receives information from others. The figure below illustrates this.
Figure 1. A typical client/server system
So why is this interesting? So far, this sounds like the
definition of a typical file server. And indeed, the repository
is a kind of file server, but it's not your
usual breed. What makes the Subversion repository special is
that
it remembers every change ever written
to it: every change to every file, and even changes to the
directory tree itself, such as the addition, deletion, and
rearrangement of files and directories.
When a client reads files from the repository, it normally
sees only the latest version of the filesystem tree. But the
client also has the ability to view
previous states of the filesystem. For
example, a client can ask historical questions like, “What
did this directory contain last Wednesday?” or “Who
was the last person to change this file, and what changes did
he make?” These are the sorts of questions that are at
the heart of any
version control system:
systems that are designed to record and track changes to files over time.
Wait! You're probably saying to yourself: "Hey, this system seems to allow more than one person to work on the same files at the same time. What happens if two people are changing the same file? Won't one person's file save overwrite the other persons' changes?" That's a critical point, and to contend with this issue, version control systems implement something called
Versioning Models. There are various models, but Subversion uses something called the Copy-Modify-Merge model. You need to understand the Subversion
Versioning Model in order to use it effectively.
Links to sub-topics
An explanation of
Versioning Models
Installing
TortoiseSVN - the version control client software
Using TortoiseSVN with
Subversion - the version control server software