Setting up an online repository

From Valve Developer Community
Jump to: navigation, search
Русский

This article describes the process of setting up an online SVN repository, and discusses a few options. For details on using SVN source control in general, see Using Subversion for Source Control with the Source SDK.

Why do I need a repository?

The biggest benefit is to combine changes made by all members of the mod team into a single "current" copy. If you're working on a mod by yourself, you probably don't need an online repository. However, an offline one will still give you many other benefits, which online repositories also provide. If you break something, you can easily compare to the previous version (or rollback to it), and easily keep track of exactly what things you've changed since the previous version. Also, if valve update the source code, a repository can make the task of merging the two versions of the code considerably easier.

Getting started

First up, you'll need an SVN client. TortoiseSVN (http://tortoisesvn.tigris.org) is highly recommended. Install it.

Next, you'll need someone to host your repository. Here, you have 3 options: a free repository for an open source mod, a free repository for a closed-source mod, and a paid-for repository for a closed-source mod.

Hosting options

Free, open source

Google code or SourceForge are the logical places to look here. Anyone can download (but not upload) your mod's source. It is perhaps debatable over whether its legal to make valve's code publicly available, as they only make it available to owners of the source sdk. It would be useless for someone without access to source sdk, but this isn't exactly legally relevant. There are a few mods that are open source, and no one seems to have complained so far, but ultimately I'm not sure of the legal ramifications. Ask Valve! Also, BitBucket can be a good alternative to GitHub's paid-for hosting. You can invite up to 5 members and create an infinite number of repositories.

Free, closed source

The options here are more limited. Apparently Multiplay.co.uk will offer free hosting for multiplayer mods on the condition that you provide them with quarterly progress updates.

Unfuddle (http://unfuddle.com/) offers free SVN hosting, along with ticket tracking, milestones, etc. Also has public and non public access to your source tree.

My own experience is with the angel scheme ($5 per month, max of 5 users) of Project Locker (http://www.projectlocker.com), which has provided consistently good service.

Local set up

Select a host, sign up for an account, and take note of your repository address. Create a mod & build the code, then you just need to work out what will go in the repository.

Choose a folder to be your local working copy, and ensure that the source code is in it. If you have space on your repository, it can be a good idea include the mod directory as well. Say your working copy has two folders in it, src (containing the source code), and GameDir (which contains a copy of your mod folder).

Now that you have Tortoise SVN installed, right click this folder, and choose SVN Checkout. Enter your repository address, and hit ok when it warns you that there's already stuff in this folder. Once that's done, you're going to want to commit your first version to the repository. Its recommended that you do this before starting any source code changes, just to be safe.

Your first commit

Right click the folder again, and choose SVN commit. Every file in the directory will be listed in a pane in this popup. First, check them all (you can push home, shift + end, then space to check them all)... there are some files that you won't want to be put in the repository, however, so make sure that you set it to ignore the intermediate output directories for both client & server (named eg Debug_HL2MP, Release_HL2MP) - those files are large and will just waste space and bandwidth. You should also make sure that any .pdb and .ncb files are excluded (these are user options and intellisense data for visual studio, and will have the same names as the project files, with different extensions.

You're now ready to go, so hit Commit and take a break while it uploads. Congratulations! You can now screw your mod up as much as you like, as you have a safe backup.

Note: when someone else on your team has made changes, committing will fail unless you SVN Update first. Its a very good habit to get into of always Updating (pulling down any changes) before Committing (pushing up your changes).