LabVIEW Development Best Practices Discussions

cancel
Showing results for 
Search instead for 
Did you mean: 

How best to rename .vi's under SCC

For me, keeping an accurate filename is an indispensible part of keeping a growing project organized. File renaming is not only useful when you change the function of a .vi (often it deserves a new filename), but also when I want to group a selection of .vis into a new folder (i.e. putting the stepper motor .vi's into a new "Stepper Motor" subfolder).

Currently, I rename the .vis within the LabVIEW developement environment or the Project Explorer.  This makes all of the relinking to any callers a snap.  I would like to start using source code control, however, this seemingly simple task of renaming appears to be a huge burden and human error-prone.  Does one really have to go through all of the steps outlined in :

Source Code Control and Group Development Practices in LabVIEW for Advanced Configuration Management...

Process for Renaming Existing LabVIEW Files in Source Code Control

Source
code control stores the history of revisions associated with a file
based upon the name of the VI. It is important that modifying the name
of a VI be done according to a specific process in order to ensure the
history of revisions is preserved. It is also important to ensure that
all links to the files from dependencies are preserved within the
LabVIEW application. Perform the following operation for statically
linked files that are currently stored in source code control.

  • Open the Project containing the application in LabVIEW - note that it is important that the Project be open and not just the file in order for LabVIEW to detect the rename operation

  • Check all files out to a single development machine

  • Perform the rename function from the source code control provide

  • Return
    to LabVIEW and refresh the LabVIEW Project by pressing ‘F5.' The file
    you renamed will have an error next to it indicating that it has been
    renamed or removed from disk

  • Right click on the file and select ‘Replace with'

  • Find and select the new version of the file

  • All links should be preserved and the history of revisions will still be associated with the VI

Is there an easier way? (perhaps scripted?)  I would think someone might have tried writing some code that programmatically makes the rename in say Perforce/SVN and completes the rename in LabVIEW.

0 Kudos
Message 1 of 10
(13,477 Views)

I just noticed that this hadn't been answered.  The process you quoted is somewhat painful, but it's not necessarily the only way.

If you're using Subversion, JKI Software developed a tool that does this for you, which I've taken to using myself.  Check out the TortoiseSVN Tool for LabVIEW

Elijah Kerry
NI Director, Software Community
0 Kudos
Message 2 of 10
(8,581 Views)

ElijahK schrieb:

I just noticed that this hadn't been answered.  The process you quoted is somewhat painful, but it's not necessarily the only way.

If you're using Subversion, JKI Software developed a tool that does this for you, which I've taken to using myself.  Check out the TortoiseSVN Tool for LabVIEW


For me renaming actions also painful. We working with MS Visual Source Safe. And for renaming I should rename VIs "twice" - in LabVIEW and in SCC. Happened not very often, but if more files should be renamed can take some time...

Andrey.

0 Kudos
Message 3 of 10
(8,581 Views)

I had tried the Tortoise SVN Tool, but didn't find that it was up to the task.  Maybe they've improved it by now?

In any case, I had decided I wanted to use Perforce, so I ended up making my own rename tool in LabVIEW by using a sequence of p4 commands from the CMD line and completing the rename in LabVIEW using VI Server.  I am still shocked how user unfriendly such a basic operation could be, but I learned a lot in putting it together.

My solution is below, but needs some pre-checks and handling of any mid-stream errors, but here's the sequence if someone's interested in a starting point in making their own tool:

Rename.png

Basically :

0. Input the reference to the vi you want to rename and it's new filename

1. Use Perforce's Integrate to make a copy of the file with a new name

2. Check out new file.

3. Rename file in LabVIEW to new file overwriting the one you just created.

4. Close and delete the orginial file from Perforce, since LabVIEW just deleted it in the previous step.

5. Submit results

-D

0 Kudos
Message 4 of 10
(8,581 Views)

> My solution is below

Thanks for sharing it! The only small trouble that the history of changes will gone, because original file deleted, then renamed submitted. It should be synchronous "rename" in SCC and LabVIEW with preserving the history.

But I forgot about SCC API - probably I can use it for simplifying such process. Otherwise I need Rename operation pretty rarely (becuase we have naming convention for files stored in SCC)

Andrey.

0 Kudos
Message 5 of 10
(8,581 Views)

The history of changes is maintained, because of that P4 Integrate command.  It's not intuitively named, but that's the way Perforce does renaming.  (See http://kb.perforce.com/?article=007).

Once Perforce has the new name for the file, I instruct LabVIEW to rename its file, so that all of the caller and subvi files are properly updated in the project.

For me, renaming is really important.  I need to have descriptive names for my .vis, and also the freedom to add functionality to those .vi's or make them more specific.  When they change, often the filename needs to change too.

-D

0 Kudos
Message 6 of 10
(8,581 Views)

Here's the code I posted a picture of earlier.

I ended up going with TortoiseSVN in the end and handling all SCC using that.  It's pretty easy to use.  Now when I do the rename in LV (or windows explorer), I see an extra file and a deleted file in the commit list of TortoiseSVN.  In TortoiseSVN, if you select both of those files, and right-click you can select "correct move", which TortoiseSVN will then interpret the operation correctly as a renaming.

-Dan

Message 7 of 10
(8,580 Views)

Dan,

Awesome, thanks for posting the code that you created.

Amiri

0 Kudos
Message 8 of 10
(8,580 Views)

Here is my procedure to rename and/or move VIs under TortoiseSVN source code control.

Before anything : renaming as well as moving VIs should be minimized after they are put under SCC. So try to have your first code files names and folder structure somewhat stabilized when committing them into SVN.

Once under SVN control, renaming and/or moving VIs basically takes the 3 following steps :

1) Open the VI to be renamed in LabVIEW editor.

2) Go to file explorer and SVN-rename the file (or SVN-move or SVN-move-and-rename).

3) Back to the opened VI, click "Save as...", choose "Rename", overwrite the SVN-renamed file.

That's it !

SVN history line is not broken this way, and the procedure is quite simple to learn and use.

"VI not found" warning can safely be ignored.

LabVIEW "Save all" and a global SVN-commit logically follow these steps to save pending changes.

I believe only JKI Software allows a faster integrated procedure.

oz

0 Kudos
Message 9 of 10
(8,580 Views)

I stumbled upon this thread (to look for something else...kind of related), I'm reactivating it: to contribute my two cents 🙂
I've been using the "TSVN Toolkit" from Viewpoint Systems for many years, this toolkit is on the "JKI Package manager", and is free, and works well (handles lvlib among other things).

Julien
0 Kudos
Message 10 of 10
(4,840 Views)