Jump to content

Questions Regarding SVN and Project File Organization


Recommended Posts

Hi all,

I am fairly new to Labview development.  I want to implement revision control software (SVN in particular) to my workplace.  Before I can do this, I need to prove the concept and usefulness of the SVN application for us.  I have used SVN in some degree in the past, and noticed tortoiseSVN integration with Labview via the TSVN Toolkit.  I have a few questions regarding SVN and how I should organize my project files, in particular when using SVN.

File organization has been a particular gray area for me in Labview, unlike linking my libraries and specifying their locations I don't seem to quite have that control in Labview.  This issue is somewhat more exacerbated (or at least so I think) when I began using SVN.  Let me explain: Using the TSVN toolkit it sees that my entire class (which was developed in a separate directory - then linked in) is not sourced and revisioned.  This is also the case for several other libraries which I have borrowed or developed myself.  I have two primary questions regarding this.

The first - How does SVN add/commit these project files when they are not present within the project directory itself?  In fact I have created a separate repo for the class which I use to maintain that code.

The second - Is my file organizational design fundamentally flawed? Especially in the context of SVN?  What are some good organizational tips/ schemes (when using SVN) which would help me for future projects in avoiding issues such as this? 

 

A  less pressing question:

How well does the "merge" functioning work with the Labview VIs?  Remember I am do not have the most experience with SVN - it is my understanding that merge basically would merge changes I have made back with changes by other devs to the file along the main trunk(?).  

 

Thanks in advance.

MrShawn

Link to comment

No advice in the merge topic other than don't do it.  LabVIEW files are obviously binary in nature, and merge doesn't work well.  That being said some developers do implement a merge paradigm in LabVIEW and SVN.  LabVIEW has some file compare tools to see what changes have changed from one revision to another but I have no idea how well they work in a SCC.

SVN also can work in the Lock/Commit paradigm where VI files will be read-only until you have requested a lock from the server (look into needs-lock).  At which point you can edit the file and commit changes but no one else can.  If they attempt to get a lock SVN will say what user has the lock at which point you can ask them if they are still working on it.  Dividing up the application into code modules and assigning a developer their set of code usually minimizes the number of times you need to ask a developer about their part of the code, but it happens.

BTW I just suggest Tortoise SVN, which is the Windows Explorer extension.  If the file is read-only, LabVIEW will complain when you go to save, at which point a save dialog will come up.  From here you can right click the file and choose to get the lock, cancel the save dialog, and resave the VI (which shouldn't be read-only any more).  Some other toolkits help in things like a rename.

If you need to rename or move a file, then LabVIEW needs to be aware of the change (the project and files that link to it) and SVN needs to know it was renamed.  Some of these 3rd party tools like ViewPoint can do this but it is generally a pain.

As for file structure.  Code that is reuse, and not part of the project needs to be found by a single common location.  My advice is either the vi.lib or user.lib.  You take your common code, package it up with VIPM, and then have all your project code link to that common stuff there.  The source to the VIPM packages can be in a separate reuse SVN repository, but your code only ever links to the code from the installed location of user.lib.  It can be more steps to make changes, since instead of changing the code in user.lib you should change the package source, build a new package, release it, then install it.  Where previously you would be just used to editing the VIs as they are.  Another alternative I've heard of but am less of a fan of, is to checkout the reuse repository to your user.lib.  Then you can edit the reuse source and commit it back to SCC.  This has advantages and disadvantages of course

  • Like 1
Link to comment

Hooovahh,  thanks for the response.

When you say "I just suggest Tortoise SVN" by that do you mean tortoiseSVN versus other client side options or are you saying do not use the TSVN Toolkit from viewpoint (http://sine.ni.com/nips/cds/view/p/lang/en/nid/211524)?

While merge is the ideal, we would likely use the lock/commit scheme, but a concern is, Dev. A is working on a control or enum that cascades down to multiple VIs will that developer need to lock out all of those VIs from Dev. B?  It seems like the best way to avoid lockout issues is with branches but my concern is how well these branches can be committed back to the main trunk for deployment, particularly for Labview.

Again, thanks for the response, a lot of good information and advice.

-MrShawn

Link to comment

I was suggesting just use the TortoiseSVN client, and not bother with any other toolkits.  JKI and ViewPoint make a couple and while they work fine, I generally just am more comfortable using Windows Explorer.  That is again for all things other than a rename, which I have used ViewPoint for, but I try to just avoid renaming unless necessary.

As for the lock commit of controls.  One thing that helps with this (but I'm not sure eliminates it) is making sure all VIs are set to "Separate compiled code from source file".  There is some code that will perform this on a project or folder of VIs, here is a start.  This should be on for all SCC options for a couple reasons.  I still think that if Dev A edits a type def control, then all the other VIs that use it will have unsaved changes for Dev A.  But if Dev B is working on a VI that uses that control, then Dev A has no obligation to update that VI, save, and commit it.  They just have to edit the control and commit.  Once Dev B does an update and gets the new control, the VI they can edit will have unsaved changes at which point they should save it and commit.  In practice this ends up with alot of "Continue Saving Without Prompts" for Dev A (since they can't get locks on those VIs which are effected by the control edit

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.