Donald Posted February 7, 2009 Report Share Posted February 7, 2009 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 1 Quote Link to comment
Yair Posted February 8, 2009 Report Share Posted February 8, 2009 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. Quote Link to comment
Chris Davis Posted February 8, 2009 Report Share Posted February 8, 2009 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. Quote Link to comment
Mellroth Posted February 10, 2009 Report Share Posted February 10, 2009 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 Quote Link to comment
Randy Posted February 10, 2009 Report Share Posted February 10, 2009 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. Quote Link to comment
LAVA 1.0 Content Posted February 10, 2009 Report Share Posted February 10, 2009 QUOTE (Donald @ Feb 6 2009, 01:33 PM) 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. 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 Quote Link to comment
David Wisti Posted February 10, 2009 Report Share Posted February 10, 2009 I tested this yesterday with a label on the block diagram in 8.5.1 and it worked fine. I did not try the FP yet. Quote Link to comment
Chris Davis Posted February 11, 2009 Report Share Posted February 11, 2009 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. 1 Quote Link to comment
LAVA 1.0 Content Posted February 11, 2009 Report Share Posted February 11, 2009 QUOTE (David Wisti @ Feb 9 2009, 10:34 PM) I tested this yesterday with a label on the block diagram in 8.5.1 and it worked fine. I did not try the FP yet. 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 Quote Link to comment
Donald Posted February 11, 2009 Author Report Share Posted February 11, 2009 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: Quote Link to comment
David Wisti Posted August 10, 2009 Report Share Posted August 10, 2009 Looks like keyword substitution does not work in Labview 2009. VI Descriptions, comments, labels, etc. are not in ascii anymore. Quote Link to comment
code ferret Posted December 14, 2011 Report Share Posted December 14, 2011 This is working for me with LV 2010, in the VI description field only, and only after I perform a check-in, as Chris mentioned. The values between "::" and "$" were inserted by SVN. I'm using tortoise, FYI. Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.