Free Game Downloads -- Sodaware.net

Free Game Downloads -- Role Playing Games, Puzzle Games and Action Games.

2 comments

Getting Started with Subversion

An introduction to using Subversion to manage your source code.


Laying out your repository

Now that we have a repository set up and a server listening for our requests, it’s time to add some files. There isn’t a rigid format for Subversion repositories, but the recommended structure involves creating three folders: trunk, branches and tags.

  • Trunk — All of your files will go in this folder. It represents the main part of the project that is being worked on.
  • Branches – This is used to store alternative versions of the project for experimental purposes. For example, you can create a branch of your project to test a new map rendering component. Checking in files will go to the branch and not the trunk, so your work won’t affect the main project. If the experiment works, you can then merge the branch with the main project.
  • Tags – Use tags for storing a copy of the source at a particular milestone. For example, you could create a tags for version 1.0, 1.1 etc. This is useful for keeping track of changes, as well as making backups in case a bug creeps in.

To set up your repository with these folders, perform the following:

  1. Create a new folder. For this example, we’ll call it “c:\myproject”.
  2. Inside this new folder, create three new folders. One called trunk, one called branches and one called tags.
  3. Optional step: Copy your project files into “trunk”.

Once your folder scheme is set up, you’re ready to import it into your repository. You can do this from the command line or using TortoiseSVN.

Command Line

svn import “c:\myproject” “svn://127.0.0.1/repository1”

If your repository is password protected, you’ll need to add -–password PASSWORD and --username USERNAME

 

TortoiseSVN

  1. Navigate into “c:\myproject”.
  2. Right click and select “import”.
  3. Enter “svn://127.0.0.1/Repostory1/” as the repository name.

Multiple projects in a single repository

Because a repository is really just a folder, you can store as many projects as you like inside it. How you lay it out is up to you. You may either use top level folders for each project, and have trunk, branches and tags folders inside or a main trunk, branches and tags folder with individual project folders.

There is no set structure, and it doesn’t really matter as long as all developers involved know how the structure works.

 

Checking out and checking in

“Checking out” is often referred to as “creating a working copy”. When you check files out of the repository, you create a copy of the files on your own machine. You can edit them freely without changing anything on the main server. When you’ve made the changes you wish and everything is working, you can check the files in, or “commit” them.

To check out via the command line, use something similar to:


svn checkout svn://127.0.0.1/Repository1/trunk/

This will check out the latest files from the trunk of Repository1. If you’re using TortoiseSVN, right click and select “SVN Checkout” and enter the URL you wish to checkout from.

Checking-in is just as simple. To commit changes using the command line, navigate to the folder your working copy is stored in and enter:

svn commit --message "Why I made these changes"

The message is optional, but it’s extremely useful to make a note of what was changed, and more importantly why it was changed. Nothing is more annoying than changing between two methods because you forgot why it was such a bad idea.

If you’re using TortoiseSVN, right click and select “SVN Commit”.

Using Tags and Branches

Tags are useful for creating a record of the source at a set release, such as version 1.0 of your project. A branch is used to create an offshoot of the project, such as testing a new algorithm.

Creating a tag using the command line:

  1. Open a command line window and navigate to your working copy folder
  2. Enter something like “svn copy trunk tags/project-2.1.0” to create a tag called “project-2.1.0″.

Using TortoiseSVN:

  1. Open your working copy folder
  2. Right click and select TortoiseSVN -> Branch/Tag
  3. Enter the URL of your new tag or branch. Typically this will be something like “svn://127.0.0.1/tags/project-2.1.0/“ for a milestone.

Important Note: If you’ve created a branch, you’ll need to create a working copy from it so that your changes will only affect the branch and not the trunk.

Further Reading

The Subversion book is available online at http://svnbook.red-bean.com/, and it contains just about everything you’ll ever need to know. There are some very powerful features, such as setting up scripts to run before and after a commit (useful for parsing comments to see if it was a bug fix).

Hopefully this article has given you all you need to set-up and use Subversion in your daily development work. It may seem like a lot of effort at the start, but it’s an incredibly useful skill to learn, and even if you only use it as an extra safety net, it’s worth the time to set up.


Pages: 1 2 3


These icons link to social bookmarking sites where readers can share and discover new web pages.

Article Info

Date: February 15, 2007

Author: Phil Newton


Categories:

Hot Game Downloads

Moon Tycoon

Moon Tycoon

Build your own moon base!


Mahjong Escape Mahjong Escape
Relax and unwind with Mahjong Escape.
Trials of Werlin Trials of Werlin
Guide Werlin through the Wizard's Labyrinth.

  1. Ed June 5, 2008
    4:13 pm

    After this:

    ( success ( 1 2 ( ANONYMOUS ) ( edit-pipeline svndiff1 absent-entries ) ) )

    Then what?

  2. Phil Newton June 5, 2008
    8:31 pm

    That line just shows you that your server is working. If you want to manipulate the actual repository, you’ll want to use a Subversion client. I recommend TortoiseSVN, because it makes the whole process much easier.

    If you want web access to your repository, it might be best to install it as an Apache module and install something like WebSVN. I use SVNRepository.com for my Subversion hosting, as everything is set up and it’s quite cheap. They also include Trac, which gives you web access and bug tracking.


Leave a comment [TrackBack URI]


Tags Allowed: a, abbr, acronym, b, blockquote, code, em, i, strike, strong



Browse By Date

Adventures in Shareware

Welcome to "Adventures in Shareware", the blog of an indie software business known only as "Sodaware". Learn all about indie games, the people that make them and how you can improve your own indie business.

Download Free Computer Games | Site Map | Links | Contact Us

© 2005-2007 Sodaware. All rights reserved. About Us | Privacy Policy