LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Getting SVN Revision while using EXE app

Solved!
Go to solution

Hey all,

 

I have searched and found the attached VI("Get SVN Rev.vi").

I combined it in my main VI and when using it in the labview editor it works fine.

After I built my main VI to exe file, it does not work anymore and cannot find the SVN revision.

What part of the VI("Get SVN Rev.vi") is not compatible with exe app? Do you have any suggestion?

 

Thanks,

Shak.

Message 1 of 4
(3,106 Views)
Solution
Accepted by topic author ShakRatz

You are apparently using a Library (LibSubWCRev) someone has written to call Tortoise SVN's SubWCRev routine that can return the Revision Number, given the location of the Working Copy.  I don't know where/how this routine gets the information as to where to find the Working Copy, but if it is invoked by a Routine within the Working Copy (particularly if this is part of a LabVIEW Project), it can use LabVIEW calls to find the Project File, and can then "guess" that the Folder enclosing the Project File is probably the Working Copy Folder (and can call SubWCRev with that folder as the "argument").

 

This is relatively easy when working in the Development mode.  When working with a built Executable, however, there is nothing "obvious" that ties the location of the .exe to the location of the Working Copy.

 

The way I chose to handle this is to use the Version Information that is part of the Executable and can be read and written by functions that were formerly in "Hidden Gems in vi.lib", but may now be available (depending on your LabVIEW Version), namely Get (or Set) Build Specification Version.  I originally tried using the Pre-Build Action feature of the Build to run a little routine of my own that called SubWCRev, got the Revision, and force it into the fourth element of the Version Number (of the form Major.Minor.Patch.Build).  However, the Build process caches the Version Number before the so-called "Pre-Build Action" runs, so you get the previous Revision number unless you "build twice".  I must confess this really annoyed me, particularly after I filed an Idea Exchange suggestion to "fix this", and someone from NI said "This is a Feature, not a Bug", to which I replied that the clear meaning of "Pre-Build" is "Before the Build" ...  You can search the Idea Exchange for Pre-Build Action, decide if you agree with me, and "Kudo" the suggestion if you do to get NI, perhaps, to fix this.

 

In any case, if you use the Version Number in the Build Spec, you can just call "Get Build Specification Version" and there you'll be.  You'll probably want to set the Major, Minor, and Patch levels yourself (e.g. 1.0.0, initially) and maybe make them "Constants" in your LabVIEW code (so you'll have them in Development Mode).

 

Bob Schor

Message 2 of 4
(3,081 Views)

If you select to also install the svn command client tool when installing TortoiseSVN (an option in the installer that is by default disabled) you can also simply use the SystemExec VI to call:

svn info -r HEAD <your local or url path)

For svn 1.9 or newer you can make the returned info string more selective by only returning specific items so that parsing the returned string is simpler:

svn info -r HEAD --show-item=last-changed-rev <your local or url path)

 

Except for the fact that you must make sure that you have the command client installed, I find this kind of interface to SVN the most versatile. There might be one other nastyness if you have selected to install a localized SVN software. Then that can complicate the parsing of the command client tool return string possibly more complicated.

 

Rolf Kalbermatter
My Blog
Message 3 of 4
(3,057 Views)

Hi everyone,

 

here is another way to show the version information in EXE.

 

Regards

Vinay

0 Kudos
Message 4 of 4
(1,714 Views)