A Tale of Two Trees


exist within a single SQL database. For this reason, I use the word "database" only when I am referring to the SQL database.

In and Out

The repository exists on a server machine which is far away from the desktop machine containing the working folder where the developer does her work. The word "far" in the previous sentence is intended to mean anything from a few centimeters to thousands of kilometers. The physical distance doesn't really matter. The SCM tool provides the ability to communicate between the client and the server over TCP/IP, whether the network is a local Ethernet or an Internet connection to another continent.

Because of this separation between working folder and repository, the most frequently used features of an SCM tool are the ones which help us move things back and forth between them. Let's define some terms:

Add: A repository starts out completely empty, so we need to "Add" things to it. Using the "Add Files" command in Vault you can specify files or folders on your desktop machine which will be added to the repository.

Get: When we copy things from the repository to the working folder, we call that operation "Get." Note that this operation is usually used when retrieving files that we do not intend to edit. The files in the working folder will be read-only.

Checkout: When we want to retrieve files for the purpose of modifying them, we call that operation "Checkout." Those files will be marked writable in our working folder. The SCM server will keep a record of our intent.

Checkin: When we send changes back to the repository, we call that operation "Checkin." Our working files will be marked back to read-only and the SCM server will update the repository to contain new versions of the changed files.

Note that these definitions are merely starting points. The descriptions above correspond to the behavior of SourceSafe and Vault (with its default settings). However, we will see later that other tools (such as CVS) work somewhat differently, and Vault can optionally be configured in a mode which matches the behavior of CVS.

Terminology note: Some SCM tools use these words a bit differently. Vault and SourceSafe use the word "checkout" as a command which specifically communicates the intent to edit a file. For CVS, the "checkout" command is used to retrieve files from the repository regardless of whether the user intends to edit the files or not. Some SCM tools use the word "commit" instead of the word "checkin". Actually, Vault uses either of these terms, for reasons that will be explained in a later chapter.

H.G. Wells Would be Proud

Your repository is more than just an archive of the current version of your code. Actually, it is an archive of every version of your code. Your repository contains history. It contains every version of every file that has ever been checked in to the repository. For this reason, I like to think of a source control tool as a time machine.

The ability to travel back in time can be extremely useful for a software project. Suppose we need the ability to retrieve a copy of our source code exactly as it looked on April 28th, 2002. An SCM tool makes this kind of thing easy to do.

An even more common case is the situation where a piece of code looks goofy and nobody can figure out why. It's handy to be able to look back at the history and understand when and why a certain change happened.

Over time, the complete history of a repository

About the author

AgileConnection is a TechWell community.

Through conferences, training, consulting, and online resources, TechWell helps you develop and deliver great software every day.