• entries
    422
  • comments
    1540
  • views
    488674

Subversion and TortoiseSVN = easy!

Sign in to follow this  
jollyjeffers

196 views

Locally based version control using SVN

Introduction

I've used various version-control systems in the past and am quite convinced they are an essential tool for the modern programmer. However I've been a bit on the lazy side with using them for my own personal development at home.

Given that I've just rebuilt my development machine with the final version of Windows Vista, Office 2007 and associated developer tools I figured it was an opportune moment to check out this Subversion software everyone was on about. Seems to be quite hard to find anyone who'll say a bad word against it [smile]

One thing that put me off setting this sort of thing up at home was that almost all examples are client-server oriented. It's assumed that you have some file-server kicking around that you use to run the actual SCM software. I don't - I've just got a pair of desktop PC's and I don't have the money to set up a file server just yet (one day I will!). In my travels I came across this mini tutorial for setting up a local copy of SVN and TortoiseSVM. It seemed almost too easy so I gave it a go - the remainder of this journal entry is just an illustrated guide to how I set it up and started using it. I know there are lots of similar (and vastly superior) articles around, but I figured it might well be of use to someone. If it is useful, then please leave a comment saying so [wink]


Setup

Firstly, download the latest SVN (I'm using version 1.4.2). Next download TortoiseSVN (I'm using version 1.4.1.7992 64bit). Install SVN first, then install TortoiseSVN - no big surprises here, no complex configuration at all...


Simple Usage

  1. Create a folder that represents your repository - just a regular Windows folder in a convenient place is fine. In this folder, right-click to bring up the standard context menu, note that TortoiseSVN has added a couple of new entries. Select 'TortoiseSVN' then 'Create respository here...":



    You'll be prompted for a file system, the default FSFS is fine:



  2. Now create another folder to represent your working directory - You aren't supposed to modify the contents of the folder from step 1. Again, a regular folder in a convenient place is just fine.

    We now begin working with this folder - create some files and starte editing them. At this point I'd choose to use the 'Install Project' feature of the DirectX SDK's Sample Browser. For the purpose of this example we just create a 'first_file.txt'.

  3. Once the basic files have been created in the working folder you need to import them into the repository created as part of step 1:



  4. Next we delete all the files in the working directory. This isn't required at all, but demonstrates how things work - this might be how things look when you're starting a new work session and need to get the latest versions of all files you'll be working with...

  5. Now, with the blank folder we need to check out the files:



    This brings up the following dialog:



    Provided everything goes according to plan you'll get the following dialog:



    Notice that the folder in the background now has a copy of the file we created previously and then deleted. It gets given a green tick icon to indicate that it's up-to-date.

  6. With the current version checked-out and ready to use we can go about editing the files. For the purpose of this example just open up 'first_file.txt' and add a couple of new lines of text. Assume that we have now finished working and we want to commit our changes back to the repository:



    Notice that the changed file no longer has a green tick - instead it's marked with a red exclamation mark. This system of icons makes it quite easy to tell which files have been modified in the current session and which may need updating or committing.

    The following image shows the dialog summarising what is about to happen. Nothing is required here - just clicking through is fine.



    If all goes according to plan (as it should!) then we get the following dialog (similar to the check-out one). Notice that the 'first_file.txt' icon has changed from red to green.



In the simplest case you can just repeat the above process as appropriate - for a few minutes playing around it's amazingly easy to get something functional up and running. Provides a nice platform for learning the more advanced functionality as you get more used to the system - things like multiple projects and versioning/branching...


Conclusion

There is a lot more to SVN than I've shown here, but as I'm sure you can appreciate it is very easy to get a capable SCM system up and running in next to no time [grin]

Hope the above was of interest and useful.
Sign in to follow this  


6 Comments


Recommended Comments

I started using Subversion at work about a month ago. So far, it's been awesome but TortoiseSVN turned out to be very error prone when used by a group. Take a look into Eclipse. It's got a pretty good plug-in for Subversion and allows you to check in and out within the IDE. If anyone knows of a better setup, I'm all ears! ;-)

Share this comment


Link to comment
I've been meaning to start using SVN...

I've not been working on too many projects though so don't see a point :P

I'm sure next year at DigiPen, SVN will become my favorite friend!

Share this comment


Link to comment
Jack, thanks for posting this. I have been working on my engine for about 3 years now, with only manual version control and backup systems. I have been meaning to start using a version control software, and this is a perfect intro to get me started.

Do you know how this ties in with VS 2005? I will likely be using the VS IDE for editing - is it difficult to check files out for use in the IDE?

Thanks again,

Jason

Share this comment


Link to comment
SVN is great! I've been using it for all of my school projects this year.

As for integration with VS2005, I believe someone on GameDev is working on an add-in. I think it's called AnkhSVN... or something like that.

Share this comment


Link to comment
Thanks for the comments!

Quote:
it's been awesome but TortoiseSVN turned out to be very error prone when used by a group
Interesting, but I guess I'll be lucky as I'm using this entirely locally and not in a team-based environment.

The command-line SVN doesn't seem too hard to handle, so I see the various tools and plugins as more of a convenience than a necessity - which is good if they don't work perfectly!

Quote:
Take a look into Eclipse. It's got a pretty good plug-in for Subversion and allows you to check in and out within the IDE. If anyone knows of a better setup, I'm all ears!
I like Eclipse a lot and am using 'Carbide.c++' for Nokia development at work. Thing is it can be quite hit-or-miss... for Java it rocks but for C/C++ its still not very good from what I've seen. That and I'm so used to Visual C++ that I just don't have the motivation to jump ship [grin]

Quote:
I have been working on my engine for about 3 years now, with only manual version control and backup systems. I have been meaning to start using a version control software, and this is a perfect intro to get me started.
Glad to hear you found it useful - I was in much the same boat, always promising myself that I'd start using it but then never got around to it [headshake]

Quote:
Do you know how this ties in with VS 2005? I will likely be using the VS IDE for editing - is it difficult to check files out for use in the IDE?
I personally don't really need IDE integration as I'll just check-out when I start work and then check-in when I'm finished (or when I'm about to make a big change). But as Dorvo posts - Ankhsvn is a VS.Net plugin. Based on the front-page of that Arild Fines is working on the project.

Cheers,
Jack

Share this comment


Link to comment
Hey cool, I use this at school in the game developer's club. It's pretty good for a group I think, really basic. We've actually used it multiple times for recalling backed up files.

Share this comment


Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now