Jump to content

SVN keyword substitution on FP


Recommended Posts

Hello All,

What is the most efficient way to get some SVN properties like Revision and Author on the VI front panel (e.g. OpenG VIs)? For text files the SVN keyword substitution works very well, for binary files (like VIs) I'm not sure how to handle this without writing some automation code.

I remember that there has been an article about CVS and keyword substitution in LTR once and was looking for something similar for SVN. To my surprise I did not found a clear article yet.

Thanks for any tips?

Donald

  • Like 1
Link to comment

I haven't done any of this, so this is just educated guessing.

Subversion clients (or is it the server software? Can't remember) have the option of installing triggers (or whatever term they use) that fire on certain actions (a commit, in this case). I don't remember the details, but I believe these are created using scripts. You can probably create a script which will call an EXE you will write using LabVIEW and pass the data using command line switches. The EXE will then open a VI server reference to LabVIEW and use that to open and modify the VI. I would suggest placing the data in a tag (8.6 has tagging VIs in vi.lib) or in the VI Description property, but that depends on how you want to use it.

Link to comment

QUOTE (Donald @ Feb 6 2009, 07:33 AM)

What is the most efficient way to get some SVN properties like Revision and Author on the VI front panel (e.g. OpenG VIs)? For text files the SVN keyword substitution works very well, for binary files (like VIs) I'm not sure how to handle this without writing some automation code.

I'm doing this now and it takes no special code modifications whatsoever. Just put the following free label on your front panel, and block diagram if you wish.

$Author::								  $$Date::									$$Rev::									 $

Then add those subversion keyword replacements as subversion properties to the VI's you want modified. The next time you commit, (which you will have to do to make the subversion properties change) you'll see the text updated. I've only done the keyword properties on windows clients, but it works every time.

BTW, this technique is known as "fixed length keyword replacement", so the spaces above are required. Subversion will search out the $Author:: $ text in your binary file, and replace it with something like $Author::Chris $. You may end up playing around with how many spaces you put in the date line, it is always the longest amount of text.

Link to comment

QUOTE (Chris Davis @ Feb 7 2009, 08:45 PM)

Then add those subversion keyword replacements as subversion properties to the VI's you want modified. The next time you commit, (which you will have to do to make the subversion properties change) you'll see the text updated. I've only done the keyword properties on windows clients, but it works every time.

:worship:

I was just starting to search for something like this. As always, LAVA is the place the look...

/J

Link to comment

I'm still not able to get this functionality to work, I've tried posting a couple of different labels on the front panel with no success (I've perused the binary file and don't find any mention of the keywords that get coded in the labels). I have been able to make this work putting the tags in the VI description (which I could pull out to the front panel or splash screen) and I thank you for the insight on the fixed length keyword replacement information to allow that but it would be nice if I could just paste a text label on the VI and not have to go through the coding.

Any more insight would be appreciated (maybe I'm not finding the correct label).

QUOTE (Chris Davis @ Feb 7 2009, 01:45 PM)

I'm doing this now and it takes no special code modifications whatsoever. Just put the following free label on your front panel, and block diagram if you wish.

$Author::								  $$Date::									$$Rev::									 $

Then add those subversion keyword replacements as subversion properties to the VI's you want modified. The next time you commit, (which you will have to do to make the subversion properties change) you'll see the text updated. I've only done the keyword properties on windows clients, but it works every time.

BTW, this technique is known as "fixed length keyword replacement", so the spaces above are required. Subversion will search out the $Author:: $ text in your binary file, and replace it with something like $Author::Chris $. You may end up playing around with how many spaces you put in the date line, it is always the longest amount of text.

Link to comment

QUOTE (Donald @ Feb 6 2009, 01:33 PM)

For OpenG VIs we use some VIs during the build process. In the post-build VIs we write the SVN properties to a FP decoration.

QUOTE (Chris Davis @ Feb 7 2009, 08:45 PM)

I'm doing this now and it takes no special code modifications whatsoever. Just put the following free label on your front panel, and

What version of LabVIEW are you using?

QUOTE (Randy @ Feb 9 2009, 04:46 PM)

Any more insight would be appreciated (maybe I'm not finding the correct label).

No you are doing it right. LabVIEW doesn't store the FP decoration as ASCII text, however VI descriptions are stored as ASCII text.

This can easily be seen with an hex-editor.

That is exactly the reason it doesn't work.

I assume Chris is using LabVIEW 7, LabVIEW 8 used a new saving technique that reduced file size (I guess zip-compression).

Ton

Link to comment

QUOTE (Ton @ Feb 9 2009, 11:38 AM)

What version of LabVIEW are you using?

I've had it working in every version of LabVIEW I've tried since 7 (7, 7.1, 8.0, 8.2, 8.5). I didn't do anything special, just added the keywords as properties within TortiseSVN's panel in a file's properties, then did a commit. I have the same text on my front panel and block diagram, no problems. In fact, it seems like Jim Kring pointed me towards the technique, but I can't find a mention of it in his blog or in any emails I have at my fingertips, just have it stuck in my memory somewhere. I'd post a screen shot or something along those lines, but I don't have anything in front of me, and I can't post from work. The only things I know that can trip one up are, make sure when you type Author, Date, Rev into a file's subversion keyword properties the three words are space-separated, not comma-separated like any normal programmer might expect.

  • Like 1
Link to comment

QUOTE (David Wisti @ Feb 9 2009, 10:34 PM)

QUOTE (Chris Davis @ Feb 10 2009, 04:12 AM)

I've had it working in every version of LabVIEW I've tried since 7 (7, 7.1, 8.0, 8.2, 8.5). I didn't do anything special, just added the keywords as properties within TortiseSVN's panel in a file's properties, then did a commit.

Strange, I used LabVIEW 8.6 with exactly the same text on the FP as on the VI description. It only worked on the VI description.

Than I looked at the contents of the ctl-file and noticed the text only once in the binary stream.

So I removed the tokens from the VI description and the strings were gone from the actual VI file.

Maybe an optimization on LabVIEW's part.

Ton

Link to comment

I was also testing with LabVIEW 8.6 and now I understand why the substitution on the FP didn't work, I was not aware that the storage of FP strings changed since 8.6. I can live with a version indication in the VIs description this is something easy to automate.

Thanks for all the tips! :thumbup:

Link to comment
  • 5 months later...
  • 2 years later...

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.