├── LICENSE └── README.md /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2011 Jörg Herzinger 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in 11 | all copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | THE SOFTWARE. 20 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | LabViewGitEnv 2 | ============= 3 | 4 | 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. 5 | 6 | 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. 7 | 8 | ## Example usage 9 | 10 | Assume you have a `master` branch with a few commits and a `feature` branch with new changes. You currently have `master` checked out. 11 | 12 | #### diff 13 | 14 | To diff those branches, you can use 15 | 16 | git diff feature 17 | 18 | which will bring up [LVCompare.exe](http://zone.ni.com/reference/en-XX/help/371361G-01/lvhowto/configlvcomp_thirdparty/) with the correct attributes and show you the differences between `master` and `feature`. 19 | 20 | #### merge 21 | 22 | To merge those branches, you can use 23 | 24 | git merge feature 25 | 26 | which will bring up [LVMerge.exe](http://zone.ni.com/reference/en-XX/help/371361G-01/lvhowto/configmerge_thirdparty/). This will show you 4 different versions: 27 | 28 | * **Base**, which is the common ancestor of `feature` and `master`, 29 | * **Theirs** which is the vi in `feature`, 30 | * **Yours**, which is the vi in `master`, 31 | * and finally the merged vi. 32 | 33 | Just edit the merged vi if necessary, save it and press close, and GIT will automagically create a nice merge commit. 34 | 35 | ##### Attention 36 | 37 | When calling 38 | 39 | git merge feature master 40 | 41 | 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 42 | 43 | git mergetool -t labview 44 | 45 | to call LVMerge.exe and do the merge. 46 | 47 | ## Windows Quick Start 48 | 49 | To download, install, and configure LabViewGitEnv for every user on your system, open a GIT Bash shell and issue the following commands 50 | 51 | mkdir -p /c/repos/other && cd /c/repos/other 52 | git clone -b windows git://github.com/joerg/LabViewGitEnv.git 53 | cd LabViewGitEnv 54 | bin/LVBootstrap.sh --system 55 | 56 | , where `/c/repos/other` is where you place your forked GitHub projects. 57 | 58 | LabViewGitEnv can automatically detect your version of LabVIEW if you have [VIKit](https://github.com/wireddown/VIKit) installed. 59 | 60 | 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. 61 | 62 | Full Instructions 63 | ================= 64 | 65 | ## 1. Install LabViewGitEnv 66 | 67 | 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. 68 | 69 | 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. 70 | 71 | ### Installation on Windows 72 | 73 | You can install this system wide or per user. If you have administrative rights, I suggest installing it system wide. 74 | 75 | ##### System Wide 76 | 77 | Open GIT Bash as Administrator and issue the following commands 78 | 79 | mkdir -p /usr/local 80 | git clone -b windows git://github.com/joerg/LabViewGitEnv.git /usr/local/ 81 | cd /usr/local && git checkout -b local 82 | 83 | If you are planning to use **GIT Gui**, open cmd.exe as Administrator and issue the following command 84 | 85 | setx Path "%Path%;GIT_INSTALL_PATH\local\bin /M" 86 | 87 | , where `GIT_INSTALL_PATH` mostly is something like C:\Programme Files\Git. 88 | 89 | ##### Per User 90 | 91 | Open GIT Bash and issue the following commands 92 | 93 | git clone -b windows git://github.com/joerg/LabViewGitEnv.git /tmp/LabViewGitEnv 94 | find /tmp/LabViewGitEnv -maxdepth 1 -mindepth 1 -exec cp -r {} ~ \; 95 | cd ~ && git checkout -b local 96 | 97 | If you are planning to use **GIT Gui**, open cmd.exe and issue the following command 98 | 99 | setx Path "%Path%;C:\Users\USER_NAME\bin" 100 | 101 | , where `USER_NAME` is your windows user name. 102 | 103 | ### Installation on Linux and Mac 104 | 105 | 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. 106 | 107 | ## 2. Configure LabViewGitEnv 108 | 109 | ##### GIT 110 | 111 | To configure GIT to use LabViewGitEnv, just open Git Bash on Windows or any Shell on Linux and Mac and issue the following 112 | 113 | LVInit.sh OPTION 114 | 115 | where OPTION can be one of the following 116 | 117 | --system 118 | 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. 119 | 120 | --global 121 | Configures user specific settings. 122 | 123 | --local 124 | Configures the Repository you are currently in. Beware: This does not get propagated through a push/pull. 125 | 126 | ##### LabVIEW 127 | 128 | LabViewGitEnv can automatically detect your version of LabVIEW to use for diffs and merges if you have [VIKit](https://github.com/wireddown/VIKit) installed. 129 | 130 | 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. 131 | 132 | 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) 133 | 134 | find /c -type f -name LabVIEW.exe -print 2> /dev/null 135 | find /c -type d -name "LabVIEW Compare" -print 2> /dev/null 136 | 137 | 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). 138 | 139 | ##### GIT Gui and other graphical tools 140 | 141 | 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. 142 | 143 | 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. 144 | 145 | ## 3. Update LabViewGitEnv 146 | 147 | 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: 148 | 149 | git stash save "local changes" 150 | git checkout windows 151 | git pull 152 | git checkout local 153 | git rebase windows local 154 | git stash pop 155 | 156 | 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: 157 | 158 | ##### Windows Quick Start 159 | 160 | bin/LVBootstrap.sh --system 161 | 162 | ##### Full Setup 163 | 164 | LVInit.sh (--system|--global|--local) 165 | 166 | Copyright 167 | ========= 168 | 169 | Copyright (c) 2011 Jörg Herzinger, see LICENSE for details. 170 | 171 | ##### Contributors: 172 | 173 | * Joe Friedrichsen, 2014 174 | --------------------------------------------------------------------------------