Getting Started with SVN for LabVIEW Source Code Control

October 17, 2014

Every now and then a LabVIEW developer will ask me about how to manage their source code on a central server and how to do version control on their code. This is what I usually tell people:


A source code control tool is an invaluable resource for anyone who develops software. Whether you work in a large team or by yourself, at a large company or a single-person shop, you can benefit from a source code control tool.


I and many other LabVIEW developers use SVN for maintaining a repository of source code. In short, SVN is a program that runs on a central server and holds all of your source code files. You also keep local "working copies" of the source code on your development machine. After you make changes to files in your working copy, you can upload those changes to the SVN server, and it will maintain a version history of the source code. If you delete / corrupt / ruin your local working copy, you can always roll back to one of the versions on the SVN server. This takes a lot of the risk out of making experimental changes to your source code. One of the nice things about having a respository on a server is that presumably your IT department is regularly backing it up. So not only do you have all the versions of the code available to you in the repository, but that repository is backed up according to your corporate IT policies. Here's a decent explanation of why you should use a source code control tool:




So there's three pieces to make SVN work for you in LabVIEW:


1. The SVN server. Ideally your IT department would set this up for you. There's different options for how to set up a SVN server. Your IT department would need to make some decisions about how to implement the server. This is free open source software! 


2. Install the TortoiseSVN client on your development PCs. This is a SVN client program that integrates nicely with Windows. There's other SVN local client programs, but I like Tortoise a lot. This is free open source software!


3. Install the TSVN Toolkit from the LabVIEW Tools Network. This is a SVN client program that integrates with LabVIEW. It works very nicely. This is free software! (Recommended but not required). Credit goes to our friends at Viewpoint Systems for creating this excellent toolkit.


Working with SVN is not difficult but there is a learning curve and possible adjustments to your workflow and project folder hierarchies. The first thing you want to make sure of is that you start setting up your source code folders in a way that lends itself to using SVN (or any source code management tool). If nothing else, please make sure that the root of each repository contains a folder called "\trunk" and place your source code hierarchy entirely within that folder. Depending on how you do projects, you may or may not want to create a separate repository for each project that you work on. 


There's a lot of nice features and functions in SVN, but to just get started with it and derive some real benefit from it, mostly what you need to understand for now is:


1. How to create a repository and "\trunk" folder


2. How to create a local working copy


3. How to commit changes to the repository


4. How to update your local working copy from the repository


Once you get used to using it, it will change your life. Later on, you can start to use more advanced features like tagging, branching, and externals. If your IT department for some reason will not cooperate and set up a SVN server for you, there is a way around needing a server but it would be much better to have a server. You should push as hard as possible to get a server set up and maintained by IT or be allowed to use an external hosted service (there are several hosted SVN services out there).


Practice with it for a bit with some files that are backed up somewhere else (so that you don't destroy any valuable work). Get to know the tool. And once you are ready, move a project into it and start making your life better!



Please reload

Recent Posts
Please reload

Please reload

Search By Tags
Please reload

Milwaukee, WI · (855) 762-6870 · · Serving Wisconsin | Illinois | Minnesota

© 2014 - 2019 by Sentient Revolution LLC. LabVIEW™ and TestStand™ are trademarks of National Instruments. Neither Sentient Revolution LLC, nor any software programs or other goods or services offered by Sentient Revolution LLC, are affiliated with, endorsed by, or sponsored by National Instruments.