Code Monkey home page Code Monkey logo

labviewgitenv's Introduction

LabViewGitEnv

This represents everything that is needed to hold your LabVIEW projects under version control with GIT. With this you can configure GIT to use LabVIEW's diff and merge tools to play with your projects.

To view the actual code, switch to the branch that matches to your operating system. Currently only Windows is supported, but porting this to Linux or Mac should be fairly easy. Please contact me if you plan to do so.

Example usage

Assume you have a master branch with a few commits and a feature branch with new changes. You currently have master checked out.

diff

To diff those branches, you can use

git diff feature

which will bring up LVCompare.exe with the correct attributes and show you the differences between master and feature.

merge

To merge those branches, you can use

git merge feature

which will bring up LVMerge.exe. This will show you 4 different versions:

  • Base, which is the common ancestor of feature and master,
  • Theirs which is the vi in feature,
  • Yours, which is the vi in master,
  • and finally the merged vi.

Just edit the merged vi if necessary, save it and press close, and GIT will automagically create a nice merge commit.

Attention

When calling

git merge feature master

GIT will not call LVMerge.exe at first, but will try to do an internal merge which will fail. You will then have to use

git mergetool -t labview

to call LVMerge.exe and do the merge.

Windows Quick Start

To download, install, and configure LabViewGitEnv for every user on your system, open a GIT Bash shell and issue the following commands

mkdir -p /c/repos/other && cd /c/repos/other
git clone -b windows git://github.com/joerg/LabViewGitEnv.git
cd LabViewGitEnv
bin/LVBootstrap.sh --system

, where /c/repos/other is where you place your forked GitHub projects.

LabViewGitEnv can automatically detect your version of LabVIEW if you have VIKit installed.

If you followed this section, you can skip the installation and configuration sections. However, if you use GIT Gui, there are few more settings to configure, and you can find them in the sections below.

Full Instructions

1. Install LabViewGitEnv

There are (or should be) four branches. The one you are seeing here (master) should be fairly empty, the other ones represent everything that is needed for Linux, Mac and Windows.

In order to run this you will need LabVIEW, GIT, and bash, which comes with msysgit for Windows users and should be preinstalled on any *nix system.

Installation on Windows

You can install this system wide or per user. If you have administrative rights, I suggest installing it system wide.

System Wide

Open GIT Bash as Administrator and issue the following commands

mkdir -p /usr/local
git clone -b windows git://github.com/joerg/LabViewGitEnv.git /usr/local/
cd /usr/local && git checkout -b local

If you are planning to use GIT Gui, open cmd.exe as Administrator and issue the following command

setx Path "%Path%;GIT_INSTALL_PATH\local\bin /M"

, where GIT_INSTALL_PATH mostly is something like C:\Programme Files\Git.

Per User

Open GIT Bash and issue the following commands

git clone -b windows git://github.com/joerg/LabViewGitEnv.git /tmp/LabViewGitEnv
find /tmp/LabViewGitEnv -maxdepth 1 -mindepth 1 -exec cp -r {} ~ \;
cd ~ && git checkout -b local

If you are planning to use GIT Gui, open cmd.exe and issue the following command

setx Path "%Path%;C:\Users\USER_NAME\bin"

, where USER_NAME is your windows user name.

Installation on Linux and Mac

Work on this is not done yet, but I suppose it should be pretty simple to do so. If you are using LabVIEW on Linux or Mac and want to use it with GIT, then please contact me and we can surely figure this out pretty fast.

2. Configure LabViewGitEnv

GIT

To configure GIT to use LabViewGitEnv, just open Git Bash on Windows or any Shell on Linux and Mac and issue the following

LVInit.sh OPTION

where OPTION can be one of the following

--system

Cofigures GIT system wide. You need administrative rights to do that, so on Windows you need to have Git Bash opened as Administrator and on Linux and Mac you have to be root or use sudo. This is recommended since GIT will be configured to only use LabViewGitEnv for LabVIEW file types.

--global

Configures user specific settings.

--local

Configures the Repository you are currently in. Beware: This does not get propagated through a push/pull.

LabVIEW

LabViewGitEnv can automatically detect your version of LabVIEW to use for diffs and merges if you have VIKit installed.

If not, you may also need to edit your LabVIEW path. To do so, edit your LVConfig.sh in either /usr/local/etc or ~/etc and adapt the LabViewBin and LabViewShared variables. LabViewBin represents the LabVIEW binary you want to use, LabViewShared represents the folder where to find LabVIEW Compare and LabVIEW Merge.

If you can't find those two, you may use the following commands to search through your system (replace the "c" with whatever drive letter your LabVIEW is installed on)

find /c -type f -name LabVIEW.exe -print 2> /dev/null
find /c -type d -name "LabVIEW Compare" -print 2> /dev/null

The first one will search for your LabViewBin, the second one will search for your LabViewShared (be sure to only use the part of the path till the Shared folder without the trailing slash).

GIT Gui and other graphical tools

Full support is currently only given for GIT Gui. If you have set your Path variable according to the installation instructions, almost everything will work out of the box.

To Diff LabVIEW files you have to open gitk and configure one more option. On Windows, open GIT Gui and view some project tree to open gitk. In gitk select Edit -> Options and choose the installed LVGitKExternalDiffWrapper.

3. Update LabViewGitEnv

Open a GIT Bash, go to the folder you installed it to ( /usr/local for system wide installs, ~ for per user installs, or /c/repos/other/LabViewGitEnv for Quick Start installs), and issue the following commands:

git stash save "local changes"
git checkout windows
git pull
git checkout local
git rebase windows local
git stash pop

Finally, one more command is needed in case some changes happened for git-config. However, you should always run this to make sure everything is configured correctly:

Windows Quick Start
bin/LVBootstrap.sh --system
Full Setup
LVInit.sh (--system|--global|--local)

Copyright

Copyright (c) 2011 Jörg Herzinger, see LICENSE for details.

Contributors:
  • Joe Friedrichsen, 2014

labviewgitenv's People

Contributors

joerg avatar wireddown avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

labviewgitenv's Issues

Hard-coded lookup paths

The paths looking for all the LV sh scripts is hard-coded to ~/ which means you need to clone this repo and move all the contents directly into your home directory. My fix was to modify all the hard links. An example from LVInit.sh would be changing:
GIT_ATTR=$(cat ~/etc/LVGitAttributes.tpl 2>/dev/null || cat /usr/local/etc/LVGitAttributes.tpl 2>/dev/null)
to
GIT_ATTR=$(cat ~/LabViewGitEnv/etc/LVGitAttributes.tpl 2>/dev/null || cat /usr/local/etc/LVGitAttributes.tpl 2>/dev/null)
had you just cloned the repo directly into your home directory.

Issue with File Location

C:\Source Code>git diff TestBranch
error: cannot spawn LVCompareWrapper.sh: No such file or directory
fatal: external diff died, stopping at LabView-Lion PM Power Automation/Power Automation Main/Power Automation Main.vi

I am trying to resolve the issue above.

I followed the instructions below with success. I also go ahead and modified LVDetect.sh and LabVIEW executable and shared paths in LVConfig.sh for LabVIEW2016 support. Not using VIKit thinking the modification would work.
My LabVIEW repo is in C:/Source Code folder. Not sure if the issue is due to having a wrong directory to install the files at as provided in Quick Windows installation guide below.

mkdir -p /c/repos/other && cd /c/repos/other
git clone -b windows git://github.com/joerg/LabViewGitEnv.git
cd LabViewGitEnv
bin/LVBootstrap.sh --system

Add instructions for .gitattributes files

In order for git to understand the settings from LabViewGitEnv a .gitattributes file needs to be generated in your local repo. Add the following line to the file:
*.vi diff=labview

automating the process of LVMerge

How do i automate the process of running LVMerge.exe without running manually.
I am using Git Extensions. The LVCompare runs fine. Kindly help me!!

Integrate changes from dsmithni/LabViewGitEnv with sourcetree support

@dsmithni [1] did some great work to make this project run with sourctree [2]. This issue is intended to integrate his work into this project to make it even more awesome. But first things first.

What needs to work

On a simple git repo these commands need to work in command line and via sourcetree:

  • git diff file.vi
  • git checkout master && git merge my_branch

If they work everything else should work too. We could create a sample repo with two branches, some commits and simple VIs to test this.

What needs to be done

  • Testing if everything works with sourcetree and via command line.
  • Refactoring some code, espacially in LVCompareWrapper.sh.
    • Most sed's can be combined in two functions: One doing FWSPATH -> FIXSYMUSR -> FIXSYMTMP, and one doing REMLEADDOT -> PATHFIX -> TRAILFIX
    • Resolving of relative path in LVCompareWrapper.sh should be a function.
    • Create a function for "make path to windows"

What could be done

I never liked using a "windows" branch too much. Maybe we should move everything into one branch and create kind of an installer, or an installable zip. A ZIP would be nice, we it had to be hosted somewhere and it would be completely static. An installer script would be nice and could do some of the configuration work, but we would have to write it.

We really need to test merging capabilities of LabView. Maybe a good solution would be to merge VIs and create a simple merge commit and later on fix the VIs. I just don't think that bigger projects can be merged in a nice way.

[1] https://github.com/dsmithni/LabViewGitEnv
[2] http://www.sourcetreeapp.com/

uir file is damaged

I meet the issue uir file is damaged when i copy a project to other computer

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.