From Thursday, May 23rd (05:00 PM CDT) through Friday, April 24th (1:30 AM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Class changes in git when creating child

Solved!
Go to solution

Hi all,

 

LVOOP question brough on by using git for source control on a project.

 

I have a repo that contains my core classes, classes that are used by multiple projects.  When I build a new system off of these core classes, I noticed that the act of creating override methods in a child class registers a change to the parent methods in git.  Why is this? There is of course no functional change to the parent.  Is there any way to get these types of changes to stop happening or a way to better account for them in my source control?

 

Thanks.

CLAD
0 Kudos
Message 1 of 11
(3,213 Views)

Hello testingHotAir,

 

So you have a number of LabVIEW Classes in git, when you make a new system off these classes and override one of the parent methods in a child class, git flags a change occurred in the parrent methods.  Is this correct?

 

Is the child class also part of the core classes or are you building that new using the parent from the new system?

What LabVIEW source control client are you using? SourceTree, Tortise, etc?   

 

Regards,

Thomas C.
FlexRIO Product Support Engineer
National Instruments
0 Kudos
Message 2 of 11
(3,095 Views)

Hi Thomas,

 

That's correct.  I've created two repos, one for the core system and one for the new stuff I'm building on top of it.

 

The child class only exists in the new repo.  It is a child of one of the classes that should only exist in the old repo.

 

I'm using git for windows.  I gave up trying to use diff with LabVIEW so I don't have another client, just command line.

 

Thanks,

Scott

CLAD
0 Kudos
Message 3 of 11
(3,084 Views)
Solution
Accepted by topic author testingHotAir

Hi Scott,

 

From what I understand about git, it registers a change has occurred if the file has been modified. 

 

I am currently trying to determine if this behavior is occuring because of LabVIEW or git. LabVIEW has a built in Tools>Compare>Compare VIs... function. I tried to recreate your behavior by creating a simple Parent and Child.  I duplicate the Parent Method VI in Windows, then override the Method in the Child. Finally, I run the Compare with the Parent Method and the duplicated original Method to see if LabVIEW has registered any changes.  I get no differences found.  When I check the Windows Timestamp of last modification of the Parent Methods, I get an old number.  This to me indicates that the file is not changing and the git is doing something weird.

 

Can you please try this out to double check?

 

Regards,

 

Thomas C.
FlexRIO Product Support Engineer
National Instruments
0 Kudos
Message 4 of 11
(3,042 Views)

Hi Thomas,

 

So your are creating a copy on disk of the parent method then overriding that copy with the child?  If so, that would be a different practice than what I'm doing.  I only have one copy of the parent method on disk (since I'm trying to re-use code).  

 

Thanks,

Scott

CLAD
0 Kudos
Message 5 of 11
(3,038 Views)

I copied the method VI in windows.  I then create an overide method in LabVIEW for the original method VI.  Then compare the copied method with the parent method.

 

This is just a test.  Can you please give it a try?

 

Regards,

Thomas C.
FlexRIO Product Support Engineer
National Instruments
0 Kudos
Message 6 of 11
(3,019 Views)

I can't seem to get lvcompare to work.  The option is disabled under Tools > Compare.  I have the pro dev system so I'm not sure why it won't let me compare VIs.

CLAD
0 Kudos
Message 7 of 11
(2,997 Views)

Ok slightly embarrassing...I forgot to commit some formatting changes I had made prior to creating the new repo.

 

That would have been a lot easier to detect if I could get lvcompare working with git for windows.  Can you point me to any resources for that?  The community doesn't seem to have a good solution pinned down for that.

 

Thanks for your help!

CLAD
0 Kudos
Message 8 of 11
(2,986 Views)

Sounds good Scott.

 

The LabVIEW Tools>Compare>Compare VIs... only works from a VI Window, not the Project Explorer.  This might have been your problem with the greyed out item.

 

I would check the Git User Group to see if they have any resources on using compare.

https://decibel.ni.com/content/groups/git-user-group?view=blog

 

I also recommend trying to use SourceTree, if you haven't.

 

Regards,

Thomas C.
FlexRIO Product Support Engineer
National Instruments
0 Kudos
Message 9 of 11
(2,974 Views)

Ok...it's still happening.  I think I figured out what is going on though.

 

If I set the method in the parent class to force children to override (Class Properties -> Item Settings -> Require descendant classes to override... -> TRUE) then every time I create a child override method it changes the file on disk in the parent class.  Is this caused by whatever mechanism in LabVIEW breaks the run arrow if a required override isn't present?  It doesn't really affect the code so it shouldn't be checked into git.  Is there a way to make git ignore this kind of change?

CLAD
0 Kudos
Message 10 of 11
(2,936 Views)