LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to Compare Two Version-Controlled Versions of the Same VI?

Solved!
Go to solution

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..

jncuevas_1-1679345680421.png

 



 






0 Kudos
Message 1 of 10
(2,179 Views)

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):

  1. The "rules" (at that time) were that the two VIs had to have a different name (not path), which involves a "rename one, compare, restore name" for each VI.
  2. Handling more than 3 or 4 VIs (by hand, it gets tedious fast).

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

Message 2 of 10
(2,147 Views)

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.

0 Kudos
Message 3 of 10
(2,104 Views)

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.


SourceTree.png

0 Kudos
Message 4 of 10
(2,101 Views)

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.

 

JimB_0-1679406251924.png

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.

Message 5 of 10
(2,084 Views)

@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.

 

JimB_0-1679406251924.png

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.

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
Message 6 of 10
(2,066 Views)
Solution
Accepted by topic author jncuevas

This works for me in SourceTree:

 

I found a wrapper script somewhere (attached) that I put in "C:\Users\thol\AppData\Local\Programs\Git\bin", then in SourceTree set:

 

thols_0-1679411528585.png

Diff command: C:\Users\thol\AppData\Local\Programs\Git\bin\_LVCompareWrapper.sh

 

Certified LabVIEW Architect
Message 7 of 10
(2,062 Views)

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

CAUTION! New LabVIEW adopters -- it's too late for me, but you *can* save yourself. The new subscription policy for LabVIEW puts NI's hand in your wallet for the rest of your working life. Are you sure you're *that* dedicated to LabVIEW? (Summary of my reasons in this post, part of a voluminous thread of mostly complaints starting here).
Message 8 of 10
(2,053 Views)

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.
SourceTree External Diff for Community.png

0 Kudos
Message 9 of 10
(1,981 Views)

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.

Message 10 of 10
(1,972 Views)