11-24-2009 02:51 PM
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 :
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 diskRight 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.
02-18-2010 04:59 PM
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
02-19-2010 02:51 AM
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.
02-19-2010 09:17 AM
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:
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
02-19-2010 09:29 AM
> 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.
02-19-2010 12:33 PM
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
06-19-2012 10:20 AM
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
06-19-2012 10:35 AM
Dan,
Awesome, thanks for posting the code that you created.
Amiri
06-20-2012 07:56 AM
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
10-14-2021 01:53 PM
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).