Version control for GLBasic (SVN)

Previous topic - Next topic


I'm no expert on SVN, just started using it at work earlier this year. But I will try to get you started and point you in the right direction where to find more information.

Why do you want SVN?

Because you want to keep track of what you do, if you want to do a big change to see if it works better you just make a new branch of the code or if you did something that totally broke your game, just reload the old code or compare the differences between the old code and the new. Every change is saved so you can always go back to any point in time that you have "committed".

Or the obvious thing, when you are more than one developer of a game you realy need this to keep organized. You can even work on the same file at the same time, you just need to run update and check the differences, then SVN should be able to patch together the two files with both your changes. (I haven't tried this though, only read about it)

How to use SVN

1. First off download these two things. If in doubt download the 32 bit Windows binaries. Install them with everything on.

SVN server and client
SVN shell for easy use (use windows explorer instead of command line :-)

2. Then decide on a safe place to store your database of changes. I usually create a folder called "svn" in the root of C:\. Inside of this I make one folder for each project I want versioned.

3. Right-click the folder you just created and select "TortoiseSVN->Create Repository Here". Repository is where SVN saves the database of changes you make. This is where your project realy will live. This folder contains everything, to remove a repository this folder is all you need to delete.

4. Now you need to import all the files you have created so far. This we do by right-clicking the folder and select "TortoiseSVN->Import". You will get a window called "Import" where you need to select the repository you created in step 3. Click the tripple-dots on the right and select it in the map-browser and then click ok.

You get a list of all files imported and then press ok

5. Make a backup of the whole original folder just in case and empty the it.

6. Rightclick the empty folder and select "SVN Checkout". Here you select the repository again and press ok. This will copy all the files from the repository to your folder for editing. Remember that this is just a copy of your project, if you don't commit your changes (right-click the folder) your changes is not in the database.


Read more here how to use SVN: SVN Book

Important notes:

Your project is now versioned and you may not rename or move files without telling SVN this. Look thru the "TortoiseSVN->" list, it is context sensitive so knows when to let you rename and move files. You can also drag files with right mousebutton to the new folder you want it and select the top line "SVN move versioned file here"

Free, online SVN book for more info and help on how to use SVN.


With the new macro support in v7 you can automate the commit process easily. Just paste this code into one of the macro buttons files. You get to them thru the menu "Tools->Macros" (when Gernot has fixed the english version).

Code (glbasic) Select
:: SVNCommit
:: The first line is used as a ToolTip for the button

TortoiseProc.exe /command:commit /path:"%GLB_PROJ_PATH%\" /closeonend:0

This will pop up the commit dialog for your project and you can enter a message about what changes you made and select what files should be updated (or commited as it is called).

If you don't want this dialog, look into these options:

/closeonend:0 don't close the dialog automatically
/closeonend:1 auto close if no errors
/closeonend:2 auto close if no errors and conflicts
/closeonend:3 auto close if no errors, conflicts and merges
/closeonend:4 auto close if no errors, conflicts and merges for local operations