11-13-2024 04:31 AM - edited 11-13-2024 04:34 AM
We’re exploring ways to leverage file diff and merge capabilities in our LabVIEW project source code control. Our team uses GitHub for our repositories, with Sourcetree as our desktop client.
I recently came across LVmerge and found it quite intriguing. I reviewed some of the documentation, but couldn’t find much information on any limitations—especially for large projects that incorporate Actor Framework and LVOOP.
Is anyone here using LVmerge extensively? Are there any known restrictions or pain points? I'd love to hear your recommendations and experiences to help us prepare for a smooth integration.
Thank you
Adarsh
LabVIEW from 2006
CLA from 2014
11-13-2024 11:32 AM
It has the same limitation as LVCompare where files have to be renamed to open multiple copies, which breaks all classes and their members. You can do something like I did here https://forums.ni.com/t5/LabVIEW-Idea-Exchange/Add-app-references-to-LVMerge-API/idc-p/4325866/highl... to get unique app instances and folder structures to get unbroken classes.
LVMerge is not very smart. For instance, if you delete and then re add the same node to your block diagram in one branch, when it goes to merge them it will interpret that as you wanting 2 of that node (it seems to be based on GUID so it sees a recreated node as an entirely different thing). I tend to not get good results from it so I usually don't use it, I use LVCompare to see what is different between the branches and manually make edits to incorporate both branches' changes.
The best advice here is to architect your software to limit the potential for merge conflicts occurring: generally this is done by having "smaller" VIs with less responsibility in each VI, thus reducing the chance that a VI is changed in 2 branches that need to be merged. OOP/AF is great for this compared to QMH/DQMH: those giant case structures are an absolute nightmare. It's challenging to even figure out what cases were added to the mega list of cases, moving a terminal or changing a datatype can show as hundreds of changes across cases. With LV classes, if all you do is add VIs there's a decent chance git will auto merge them correctly.
Another nugget is to limit unnecessary changes that result in unneeded conflicts: rule 1 is to enable "separate compiled code" on all files. Another is to revert files that were resaved and committed but don't need to be changed in the main branch: for instance if you edit the private data control of a class, you don't have to resave every member of that class, just those directly affected by the change.
LV Projects have a high chance of being conflicted due to the dependencies list: one strategy there is to delete the dependencies list from the XML in both branches being merged.
11-13-2024 11:10 PM - edited 11-13-2024 11:13 PM
I would be even more drastic. LVCompare and LVMerge are a joke. But I would back that with AF your chances are good that you can get around them without loosing much. (High cohesion)
I always add .lvclass and .lvproj to .gitattributes so that git won't try to merge them.
Git can work on collab in small teams with labview but will definitely be a disaster for bigger teams at some point. But this is the burden of binary files I guess
11-14-2024 02:31 AM
I think LVCompare is really well usable when setup with with Sam's The Absolute Easiest Way to Setup LVCompare and LVMerge and having a git tool which allows you to open the specified difftool.
My go to is the Git Diff and Merge Tool extension for VS Code, which allows to to right click on any changes and open LVCompare.
Together with a good modular application structure, which is also repeated in the folder structure git works quite well across teams, limiting edits on branches to specific folders and handling possible conflicts through communication in the team
11-14-2024 02:39 AM
In the GUI module you can do the same for the cloneable instances of the Logger and DAQ modules.
I think LVCompare is really well usable when setup with with Sam's The Absolute Easiest Way to Setup LVCompare and LVMerge and having a git tool which allows you to open the specified difftool.
My go-to tool is the Git Diff and Merge Tool extension for VS Code, which allows to to right click on any changes and open LVCompare.
Together with a good modular application structure, which is also repeated in the folder structure git works quite well across teams, limiting edits on branches to specific folders and handling possible conflicts through communication in the team
11-14-2024 08:02 AM
@Quiztus2 wrote:
I would be even more drastic. LVCompare and LVMerge are a joke. But I would back that with AF your chances are good that you can get around them without loosing much. (High cohesion)
I always add .lvclass and .lvproj to .gitattributes so that git won't try to merge them.
Git can work on collab in small teams with labview but will definitely be a disaster for bigger teams at some point. But this is the burden of binary files I guess
I don't think NI does a good job of making LabVIEW suitable to be "software engineered" and every time I've seen a project get large enough it has felt more like a trap than a useful tool. How is something as basic as a code review such a nightmare?
Maybe 30 years ago it was forward looking to think that programming would be graphical but now it means all these great tools like git, docker, ci/cd, all have inferior and finnicky usability when they work at all with LabVIEW.
11-14-2024 09:04 AM
sad, but true.