From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW Development Best Practices Blog

Community Browser
cancel
Showing results for 
Search instead for 
Did you mean: 

Using Subversion (SVN) with LabVIEW

Elijah_K
Active Participant

As anyone who has asked me about source code control knows, I've become a very big fan of Subversion; specifically, TortoiseSVN.  I originally started using it because a large number of NI customers I was speaking with had made the switch, due in no small part to the price tag (it's free).  But it's not just the price that makes it so appealing - TortoiseSVN is very easy and simple to use, which makes it something that makes you more efficient, rather than weigh your development process down.

If you're not using source code control at all, you're playing with fire.  And since Subversion is free, you now have no excuse.  Still not convinced?  Has any of the following ever happened to you:

  • You delete or change some code as part of an experiment or perhaps debugging, and then save it.  If you want to undo these changes, you have to redo it yourself.
  • You want to experiment with a new implementation or function, so you save the old VI or project to 'My Project OLD,' to make sure you have your backup handy. (Now you have a bunch of other copies of your application all over your laptop and your network drive).
  • You want someone else to look at your code or even modify it. (again, you put a copy on the network folder or a jump drive... but when you make a change, you have to go do it all again!)
  • You open an older copy of your application or a copy saved in a different location, causing a link conflict (lets face it, fixing this is not fun)
  • You introduced a bug into your code a few days ago and want to revert to an older version to figure out what changed (too bad)
  • An angered or jealous C developer steals your laptop and destroys it, taking with it the only copy of your code. (that's what you get for under-bidding him by 3X)

Any of these could've been avoided or made easier if you'd been using source code control.   So go download Subversion!  Go here.

UPDATE (7/29/13)

There is now a free plugin from Viewpoint Systems that sets up integration with Tortoise for you (including diff and merge) and overlays the icons in the Project Explorer - the best part is that it's totally FREE.  I strongly recommend that anyone using SVN+LabVIEW install this tool.  The latest version can be found here: Subversion Version Control for LabVIEW. Please make sure you already have Tortioise installed - if you don't, make sure to restart your computer after installing Tortoise.  You'll also need to restart LabVIEW after installing this plugin.  Enjoy!

Tip 1

If you're going to use Subversion with LabVIEW, you need to know a few things.  Subversion stores some hidden folders and files in your directory structure, which can cause some problems when mass compiling or using auto-populating folders.  Not to worry!  Open your labview.ini file and enter 'skipSVNFolders=true' to resolve this issue (only works in 2009, will be on by default in 2010).

Tip 2

If you're using the professional version of LabVIEW, you can tell Subversion (or any source code control tool) to invoke the command-line diff and merge executables.  To set this up, right click in Windows Explorer and select TortoiseSVN > Settings.  Select Advanced and enter the following for a .vi file type (this can also be used for a .ctl)  "C:\Program Files\National Instruments\Shared\LabVIEW Compare\LVCompare.exe" %mine %base -nobdcosm -nobdpos.  Do the same for merge, but enter "C:\Program Files\National Instruments\Shared\LabVIEW Merge\LVMerge.exe" %base %mine %theirs %merged.  The command line parameters are explained in the LabVIEW help, click here for LVCompare.exeMore info on command-line differencing.

Getting Started with Subversion

If you've never used source code control and want to give it a try, check out this hands-on exercise and example program I published here: http://decibel.ni.com/content/docs/DOC-10122

As for experienced source code control readers and users, what packages are you using, and do you have any tips for use with LabVIEW?  Is anyone using Git or Mercurial? (two other popular open source SCC providers)

Elijah Kerry
NI Director, Software Community
Comments