LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

LabVIEW with Git


TannerLD wrote:

 

I'm hearing that SVN is more commonly used because it has the ability to lock files which will prevent another user from editing the same Vi?


SVN can work in the locking mode, but it's not its default setting. The default is letting each user have their own fully open copy and having the users manage when and how they interact. The lock is actually more of a problem with LV, because you need the SCC to change the file to read only so that LV can recognize it's locked. As I said, there is some reading material available.


___________________
Try to take over the world!
0 Kudos
Message 11 of 28
(6,504 Views)

Hi

 

any news on getting Git to work with labview? I got my code already in git and that part works great, but I don't manage to use LVCompare as the diff tool.

 

Here is my setup so far:

 

defined a global in git config

 

> git config --list |grep labview

 

diff.labview.command=mydiff

 

> cat mydiff

 

#!/bin/bash

 

echo "testing diff"

echo /c/Program\ Files/National\ Instruments/Shared/LabVIEW\ Compare/LVCompare.exe

echo $2

echo $5

echo "calling LVCompare..."

/c/Program\ Files/National\ Instruments/Shared/LabVIEW\ Compare/LVCompare.exe "$2" "$5"

 

if I run now for example "git diff HEAD^..HEAD^^", the mydiff program gets called, I can see that $2 and $5 are the temporary files I want to compare, but LVCompare complains about the fact that a file with the same name is already loaded in memore... not sure what I'm missing or how to change this. Any ideas?

 

cheers

      ARUN

0 Kudos
Message 12 of 28
(6,414 Views)

You can't have two VIs with the same name open in the same project at the same time, unless those VIs are members of a library, which provides a namespace. If you try to open a VI and there's already another VI with the same name in memory, you get this message.

 

SVN doesn't have this problem, because when you do a diff, it adds the revision number to the name of the temporary file, so it has a different name than the VI which is already open. I haven't used LVCompare (I use LVDiff, and even that not very much), but I believe Tomi Maila had a post on his blog about using LVMerge, and presumably, it includes info on this.

 

Also, there was a recent discussion in the LAVA forums about using Mercurial, which I understand uses similar concepts to Git. I suggest you look at that discussion.


___________________
Try to take over the world!
0 Kudos
Message 13 of 28
(6,402 Views)

tst wrote:

You can't have two VIs with the same name open in the same project at the same time, unless those VIs are members of a library, which provides a namespace. If you try to open a VI and there's already another VI with the same name in memory, you get this message.

 

[...]

Also, there was a recent discussion in the LAVA forums about using Mercurial, which I understand uses similar concepts to Git. I suggest you look at that discussion.


 

The files do have different file names... git creates two copies of the file in a temporary directory and the copies include the commit-hash... Is the name of a VI given by the filename or internally set?

 

 

Thanks for the pointer to the LAVA forum... I'll check it out.

 

Arun

0 Kudos
Message 14 of 28
(6,386 Views)

The fully qualified name is the name of the file along with any libraries which may own the VI.

 

You should note that the path to subVI is stored as a relative path. If the subVIs are not already in memory when you open the VI from the temp folder, it will have to start looking for them (since the temp folder is not where the VI originally was. I assume this might be your problem. Another alternative is that the subVIs are already in memory and loading the caller VI from the temp folder informs you that it found the VIs not where it expected to find them.


___________________
Try to take over the world!
0 Kudos
Message 15 of 28
(6,367 Views)

You could add the temperory directory GIT uses in the Search settings of LabVIEW (however this will trigger an unwanted DIFF).

 

Ton

Free Code Capture Tool! Version 2.1.3 with comments, web-upload, back-save and snippets!
Nederlandse LabVIEW user groep www.lvug.nl
My LabVIEW Ideas

LabVIEW, programming like it should be!
0 Kudos
Message 16 of 28
(6,369 Views)

configuration:

 

$ git config --list 

... 

diff.tool=lvcompare
difftool.lvcompare.cmd=lvcompare.sh "$LOCAL" "$REMOTE"
difftool.prompt=false

...

 

lvcompare.sh:

 

#!/bin/sh

# Bash script to generate correct calling syntax for LVCompare inside MINGW32 on XP.

# Script assumes only 2 arguments since it is typically called via 'git difftool'
# Can also be called standalone

# If a full path is already specified, don't prefix the working directory.
# Otherwise, prefix the working directory.

# File paths are only considered using '/'
# Does not handle relative paths
# Does not handle mixed '/' and '\'
# Does not handle '\'
# Two file name arguments only

# Script directory must be in $PATH
# i.e. PATH=$PATH:/c/system-test/scripts


case $1 in

 */* ) case ${1##*/} in     # Full path case
   .* ) tgt1=${1/./TMP}.vi
    echo $tgt1
    cp $1 $tgt1;;    # Copy hidden file and add .vi extension
   * ) tgt1=$1
    echo $tgt1;;    # No adjustments
  esac;;
 * )  tgt1=$PWD/$1      # Create full path
  echo $tgt1;;      # File name only case
esac


case $2 in

 */* ) case ${2##*/} in     # Full path case
   .* ) tgt2=${2/./TMP}.vi
    echo $tgt2
    cp $2 $tgt2;;    # Copy hidden file and add .vi extension
   * ) tgt2=$2
    echo $tgt2;;    # No adjustments
  esac;;
 * )  tgt2=$PWD/$2      # Create full path
  echo $tgt2;;      # File name only case
esac

# Replace forward slashes with back slashes

tgt1=$(echo ${tgt1} | sed 's/\//\\/g')
echo $tgt1
tgt2=$(echo ${tgt2} | sed 's/\//\\/g')
echo $tgt2

echo Launching LVCompare.exe: $tgt1 $tgt2 # Names are friendly...

# LVCompare command line

"C:\Program Files\National Instruments\Shared\LabVIEW Compare\LVCompare.exe" "$tgt1" "$tgt2" -lvpath "C:\Program Files\National Instruments\LabVIEW 2009\LabVIEW.exe" -nobdcosm -nobdpos -nofppos

# Improvements:
# Copied file cleanup
# Command line invocation handling to change drive designation from /c/ to c:/

# Notes:
# echo $PWD # Where do we originate?
# echo $0  # Where is script?
# echo ${1/./TMP}.vi  # Replace leading '.' with 'TMP' to make file visible and append '.vi' extension
# echo $PWD/"$2"  # Append full path
# echo sed 's/\//\\/g'  # 's(ubst)/replace_this/with_this/g(global)' '\/'=escaped forward slash '\\'=escaped backslash

invocation:

$ git difftool HEAD^ HEAD mytest.vi (modify refs as necessary)

 

caveats:

pay attention when diffing VI hiearchies

Message 17 of 28
(6,273 Views)

Hi ewichter

 

tried your setup, but still get the following error:

 

 

An error occurred while running LVCompare. Invoke Node in LVCompare.vi <APPEND> Method Name: <b>User Interaction:Compare VIs</b>

 

I also am not able to run LVCompare just from the command line 😞

 

Arun

 

 

0 Kudos
Message 18 of 28
(6,200 Views)

Are you using LabVIEW Professional?

 

 

From the help file: 

 

 

Note  LVCompare.exe is available only in the LabVIEW Professional Development System.

0 Kudos
Message 19 of 28
(6,140 Views)

That's it... I'm using a Full Version not the Professional one... LVCompare ist still installed, but apparently unusable. Guess the errormessage could be better 😉

 

Thanks

 

Arun

0 Kudos
Message 20 of 28
(6,096 Views)