03-20-2023 04:02 PM
Hello,
Right now the best way I have to compare two version-controlled VIs is to clone the repository twice and checkout a different branch in each clone, then actually open the the projects and files. At that point the LVCompare tool is practically useless because I can compare them with my own two eyes.
Does anyone have a better way to compare two source-controlled VIs? Something that integrates into the source-control environment, maybe? I just want to do this very basic software development task 🤔
My team is using Git and SourceTree and BitBucket to version-control our LabVIEW code.
I found some instructions on line for setting up SourceTree to use LVCompare, but they didn't work. There was no explanation as to why they didn't work, just the standard SourceTree blurb about binary files.
So I tried running LVCompare from the command line myself to see if I could figure out the problem. That gave me the error below, which is not helpful. My guess is LVCompare couldn't open the VIs alone because they are part of a library, and LabVIEW itself gives me an error when I try to open them alone..
Solved! Go to Solution.
03-20-2023 08:17 PM
I haven't revisited using LVCompare since the time of LabVIEW 8-somthing. There were two problems, particularly when dealing with "lots of code" (like two "versions" of a Project with more than 20 VIs, maybe even more than 200, or 2000):
I wrote a little routine that let me compare the same file from two different Projects using a little trick -- I modified the name of one of the files by adding an extra "extension" (hmm -- I'm forgetting exactly how I changed the extension -- I think I changed it from ".vi" to ".tmp), fed the two files to LVCompare, and when done, changed the name back.
The other problem just involves parsing the Folder Tree, finding matching files (and excluding the "uniques", and deciding what to do with what you discover.
Bob Schor
03-21-2023 07:41 AM
Hello Bob_Schor and thanks for the reply!
I was a little frustrated yesterday because I thought I was going to be able to accomplish what I wanted - seeing a diff view in SourceTree without any extra cloning - but it sounds like that's not the case.
It's not a big deal but I got my hopes up 🙂
I'll try what you suggested next time.
03-21-2023 07:48 AM
To clarify what I was trying to do yesterday - I would like to see a diff of my local VI compared to the original repository VI (or a preview) in SourceTree.
If that's not possible, I would also be happy with anything that simplifies my current process.
03-21-2023 08:58 AM
I've never heard of being able to view it inside of SourceTree. That would require VICompare to work as some sort of plugin that SourceTree knows how to load into that window. If you have more information regarding where you heard that, I'd be curious to know more, but, AFAIK, you need to configure it as an external diff tool.
I can't give help specific to SourceTree or Git in general since we use Perforce, but I can share that this is how I have it configured for .vi files in P4V.
Arguments: %1 %2 -nobdcosm -nobdpos
It works for me without having to do anything extra, but P4 adds the revision number to the file name when comparing by default so the file name may indeed have something to do with it.
03-21-2023 10:15 AM
@JimB. wrote:
I've never heard of being able to view it inside of SourceTree. That would require VICompare to work as some sort of plugin that SourceTree knows how to load into that window. If you have more information regarding where you heard that, I'd be curious to know more, but, AFAIK, you need to configure it as an external diff tool.
I can't give help specific to SourceTree or Git in general since we use Perforce, but I can share that this is how I have it configured for .vi files in P4V.
Arguments: %1 %2 -nobdcosm -nobdpos
It works for me without having to do anything extra, but P4 adds the revision number to the file name when comparing by default so the file name may indeed have something to do with it.
Subversion does the same. If you check out version 1301 you'll have file.1301.vi to compare to file.vi and it'll work.
03-21-2023 10:17 AM
03-21-2023 11:43 AM
Things work for me from SourceTree too, but my path looks a little different than the one for thols. FWIW, here's mine.
Diff command: "C:\Users\USERNAME\AppData\Local\Atlassian\SourceTree\git_local\bin\_LVCompareWrapper.sh"
As I recall, I located the referenced shell script by following a link in a thread over on lavag.org Couldn't immediately locate it again just now though.
-Kevin P
03-22-2023 08:43 AM
Thank you community!
I just realized that the command setting is for "external" diff and I have to use the External Diff button 🙈
It's not within SourceTree but it's simple enough.
03-22-2023 08:51 AM
Another note:
LVCompare will open the VIs in the last selected context from LV.
If you were last on RT, it will try to run LVCompare as RT-code which will fail.
Make sure to click on "My Computer" in a project before calling it from SVN or Git.