New domain and blog

New domain and blog
Please head over to my new domain to view my blog and current projects

Monday, 22 April 2013

Source Control for LabVIEW using TortoiseSVN

For a long time now I have been using LabVIEW, but I am not very diligent at using source control. Source control is one of those things that you never really need until it's too late. So this weekend I decided to install TortoiseSVN on my laptop to start out small, but get into the habit of backing up and recording the changes I make to my code. 

To get up and running is rather easy. Go over to TortoiseSVN and download the install file. Once installed, you are ready to get going. 

The first thing to do is make a folder somewhere to store your repository. I called mine svn_repos. Now right click, you will see an option for TortoiseSVN. Select the Create repository here option from the drop down menu. 


Once you have created the repository, go over to the folder that you want to back up. Right click on the folder and select the import option under the TortoiseSVN menu. A window will pop up where you need to enter the path and details of the change. My folder name is TemperatureLogger so just change that in the path to suit your folder.


Press OK and all the files in that folder will be backed up.

Now you need to get a  working copy. I use the same folder but you can select any folder for your working copy. Right click on the folder that you have just imported and select the SVN Checkout option. Select your path and if it is the same path you will get a warning. Click OK and when the checkout is complete, you will notice that there is a green tick icon over the folder. When you make any changes to the files, that green icon will turn red.

The LabVIEW part is to now install the JKI Toolkit for TortoiseSVN. Firstly you need to install the VI Package Manager. Once installed, search for TortoiseSVN in the user interface and install it. This takes a couple of minutes and needs your input for a few of the steps.

Once everything is installed, open one of the files that you previously imported and checked out in LabVIEW. Make any change and then save it. You will now notice that there is a red icon over the files that have been changed. 


In LabVIEW, go to tools > TortoiseSVN > commit. 


Here you will be given the option to add a comment for the changes that were made. This helps you track your changes over time.


You will now notice that icons over the files are back to green letting you know that you have backed up all your files.


You can also get these options directly from Windows Explorer, but it is really convenient to have the option to back up your work directly from LabVIEW. There are many more tools to be used and they are explained pretty well in the documentation.

Well I hope this helps you start to back up and document the changes that are made to your programs. Please don't forget that this can be used for any type of files, not just in LabVIEW. All you need to do is right click on the file or folder and choose the option under the TortoiseSVN menu.

Greg