Using Subversion for Source Control with the Source SDK

From Valve Developer Community
Revision as of 23:30, 27 June 2008 by Coldacid (talk | contribs) (Started article draft)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

This article describes how to use Subversion with the Source SDK. Subversion is a revision control system that is free to use by anyone. The article won't talk about installing Subversion or how to create a repository (just yet); for that, you can read Version Control with Subversion, either online or from O'Reilly Media.

Starting Up

To begin, create a new repository for your project. This repository will be home for your code, and if you'd like, your mod's various other assets. Once your repository is created, make a new directory and check the fresh repository out, into that directory. You'll notice, if you have show hidden files on, that there is another directory in there now, called .svn. Subversion creates a directory like this in each directory of a working copy (WC) -- the area in which you work on your project.

Right now, other than this directory and the metadata Subversion keeps in working copies, there's nothing at all. That's because a fresh repository doesn't have any content, of course. And before we throw in any mod content, we'll partition our repository into four areas, each with its own directory, according to a simple and logical scheme. In your working copy, create these directories:

branches/
tags/
trunk/
vendor/

I'll explain each of these, although not in alphabetical order. The trunk/ directory is where you do your active development. Your project's files will be kept here normally, and most developers will only have this part of the repository in their working copy. Because Subversion versions entire directories as opposed to just files, the branches/ and tags/ directories allow you to develop code without it being on the trunk (for example, when you're preparing a release), or saving a particular state of your project (for example, the code and assets for a particular release). Last, vendor/ allows you to track external code and merge it easily into your own, such as what we'll be doing with the Source SDK code provided when you create a mod.

Add these new directories to your working copy, and then commit your changes. You'll find tasks like these to go much faster and easier with TortoiseSVN, a Subversion client and Windows add-on which adds Subversion-related items to the context menu in Explorer.

Creating the Mod