Git User Group

cancel
Showing results for 
Search instead for 
Did you mean: 

Git and Labview Merging

Discussion about LVMerge

http://forums.ni.com/t5/LabVIEW-Idea-Exchange/Improve-LVMerge-and-LVDiff-for-integration-with-third-...

GIT and LVMerge setup details:

https://decibel.ni.com/content/docs/DOC-2936/diff?secondVersionNumber=8

The setup strings for LVMerge and Diff look similar to this:

"c:\Program Files\National Instruments\Shared\LabVIEW Merge\LVMerge.exe"   %base %mine %theirs %merged

"C:\Program Files\National Instruments\Shared\LabVIEW Compare\LVCompare.exe" %mine %base -nobdcosm -nobdpos

For file extensions: .vi, .ctl, .xctl, .lvclass, .lvlib

NOTE: that the merge and diff are in a shared folder and independent of the Labview

version.  However, there are OTHER Labview version issues.

This is a useful, but slightly out of date tutorial, for Mercurial.

http://labviewwiki.org/Mercurial

READ THIS, note the date in October 2011.

https://decibel.ni.com/content/blogs/Matthew.Kelton/2011/10/03/labview-and-versionsource-code-contro...

https://docs.google.com/document/pub?id=1Lmx9WI1g_ObB03Vrlfb7QU3ochz1q_YRGM8dPi0R8g8

Video:

(Note: be sure to watch this in HD, not the default resolution).

http://www.youtube.com/watch?v=2dEI6tEMTmQ

http://forums.ni.com/t5/LabVIEW/using-github-for-version-management-for-Labview-VIs/td-p/1838121

http://lavag.org/topic/16300-how-should-i-set-up-git-for-labview/

https://github.com/joerg/LabViewGitEnv

https://sites.google.com/site/narasimhaweb/projects/arduino-labview-interface

http://www.chiefdelphi.com/forums/showthread.php?t=110080

https://decibel.ni.com/content/servlet/JiveServlet/download/23600-1-51193/TS8235%20SubVersion%20and%...

#############################################################################

To replace a single file from the remote:

http://stackoverflow.com/questions/3949804/git-force-overwrite-of-local-file-with-whats-it-origin-re...

In windows explorer, goto the folder that contains the file to be checked out. Right

click, select Git Bash, then enter the string:

git fetch

git checkout origin/master <filepath>

<an example>

Mike@MIKE-PC-I7 /E/GitFolder/intrinsic/code/Program support (master)

$ git checkout origin/master "Create User Events.vi"

#############################

.gitignore

.aliases

.lvlps

/Built

/Build

What to do about them.

http://stackoverflow.com/questions/2798477/industry-style-practices-for-increasing-productivity-in-a...

Also it's important to add *.lvlps and *.aliases to your ignore list, these files don't have a usefull meaning on another computer.

0 Kudos
Message 1 of 13
(30,875 Views)

Hi,

one of our Customers is using Git but he had some issues with he tries to merge VI's. He has followed your guide but he receives Error 7 during merging VI's. Propably it's an configuration issue because Error 7 means that ther is a missing file. Attached you can finde a screenshot.

labview_merge.png

Has someone experiences with Git and merging? What can cause the issue?

Regards,

Philip

NIG

0 Kudos
Message 2 of 13
(15,732 Views)

https://github.com/joerg/LabViewGitEnv works for me, but only from the git bash. I couldn't get diff and merge to work with git extensions

Andreas Stark
LabVIEW Lead @ Rocket Factory Augsburg
0 Kudos
Message 3 of 13
(15,732 Views)

Actually the LVCompare works with Gitextensions. Even though it runs on the right click. LVcompare works. LVMerge fails. Please share your thoughts regarding configuring and LVMerge with GitExtensions or git??

thanks

0 Kudos
Message 4 of 13
(15,733 Views)

I just finished setting up some custom work to make LVCompare/LVMerge work with VIs.  I will probably make a separate post later to share, but in the mean time, the reason the above setup string fails with error 7 has to do with paths.

The first error is the order of arguments for LVMerge is actually: Base Remote(theirs) Local(yours) Merged.

The other note is LVMerge requires (I think?) full paths, and git doesn't automatically supply them.  I wrote a bash script that alleviates this, but it requires some more tinkering to use fully with git.  My current setup seems to work seamlessly from git bash, even with merges on more than one VI at a time.

Stay tuned...

Message 5 of 13
(15,733 Views)

>> For file extensions: .vi, .ctl, .xctl, .lvclass, .lvlib

I believe at the present moment neither LVMerge nor LVCompare support container file types such as xcontrol, classes, libraries and projects.

0 Kudos
Message 6 of 13
(15,733 Views)

jpetrie, don't the variables $LOCAL and $REMOTE return the paths?

0 Kudos
Message 7 of 13
(15,733 Views)

Well, I can't get LVMerge to launch without error 7. This is from SourceTree, the Git management frontend from Atlassian. I doubt it'll work anyway, merging classes and libraries isn't possible, so I'll only end up with a mess. Worth a try, but I think I'll leave this alone.

Even LVCompare balks when launched with errors regarding paths. It appears the variables $LOCAL etc do indeed return relative paths with an incorrect separator ('/' instead of '\') so the true VI location is not provided. Ridiculous.

Thoric (CLA, CLED, CTD and LabVIEW Champion)


0 Kudos
Message 8 of 13
(15,733 Views)

Thoric wrote:


                       

Well, I can't get LVMerge to launch without error 7. This is from SourceTree, the Git management frontend from Atlassian. I doubt it'll work anyway, merging classes and libraries isn't possible, so I'll only end up with a mess. Worth a try, but I think I'll leave this alone.

Even LVCompare balks when launched with errors regarding paths. It appears the variables $LOCAL etc do indeed return relative paths with an incorrect separator ('/' instead of '\') so the true VI location is not provided. Ridiculous.


                   

Have you checked out this forum post yet?  I don use TortoiseGit and i haven't run into any issues in getting merge/compare to launch. 

http://lavag.org/topic/17934-configuring-git-to-work-with-lvcompare-and-lvmerge/

Once you get things working its still a pain no mater what source control methoud your are using.  Labview just isn't built to merge/compare easily. 

0 Kudos
Message 9 of 13
(15,733 Views)

I confirm. Error 7 is a result of two things:

1. Git is a tool which comes from Linux. It is using slash and not backslash as a separator in paths. LabVIEW tools don't accept this.

2. Git is using relative paths. LabVIEW need absolute.

I also wrote a script to overcome this. It's a wrapper for diff/merge tools which recognizes if we work with .vi or other files. Based on that it decides if regular diff/merge tool or LabVIEW diff/merge tool should be used.

The script is written in Python3 and using Linux bash commands. This means that Python interpreter should be installed and added to PATH variable. Unix tools from MSysGit also must be added. Finally merge tools and mergewrapper also must be added to PATH.

To summarize, I recommend to add the following paths to PATH variable:


<pythondir>

<pythondir>\Scripts

<gitdir>\mingw64\bin

<gitdir>\usr\bin

<kdiff3dir>

<National Instruments>\Shared\LabVIEW Compare

<National Instruments>\Shared\LabVIEW Merge

<mergewrapperdir>


Script itself can be downloaded below:

https://files.fm/u/a7ct27ak

Here is how to configure SourceTree to use the wrapper:

Tools -> Options -> Diff

External Diff Tool: Custom

Diff Command: mergewrapper.bat

Arguments: --diff $LOCAL $REMOTE

Merge Tool: Custom

Diff Command: mergewrapper.bat

Arguments: --merge $BASE $LOCAL $REMOTE $MERGED


0 Kudos
Message 10 of 13
(15,733 Views)