Setting up LVCompare and LVMerge

There has been some discussion on LinkedIn and other places about how best to setup LVCompare and LVMerge. These tools have been around for a while, yet discussions on how to set them up and get them working still persist. If you look on the forums you can find posts from going on 10 years ago.

LVCompare in Action.
LVCompare in action.

Part of the problem is that preferences have changed over the years as far as the Git client of choice. For a while it was TortoiseGit, then SourceTree and now it has moved onto other GUI tools such as GitKraken and Fork. Each GUI has a different interface for setting it up. Some worked with LVCompare and LVMerge out of the box and some required special wrappers. It is certainly confusing, but the information is out there. I am going to try to distill it all into one spot. I hope I am not just adding to the noise.

I’d like to share what I do that seems to work both from the CLI and from all the various GUIs. All of the GUIs (I’ve only tested Source Tree, Tortoise Git, and Git Kraken) seem to recognize an external diff/merge tool that is set in the gitconfig file right off the bat, so there should be no additional configuration needed. Simply set this up once and then it should work with the CLI and any client.

Setup Steps

  1. Clone this GitHub repo: https://github.com/smithed/vicompare.git (not my repo – created by Daniel Smith of NI)
  2. Open the LabVIEW project and build each build spec in order (there should be 4 and they are numbered)
  3. Run the installer you just built.
  4. Then run the shell commands shown below.
git config --global diff.tool LVCompare
git config --global difftool.LVCompare.cmd 'C:\\viscc\\vidiff.exe "$LOCAL" "$REMOTE" -nobdcosm -nobdpos'

git config --global merge.tool LVMerge
git config --global mergetool.LVMerge.cmd 'C:\\viscc\\vimerge.exe "$BASE" "$REMOTE" "$LOCAL" "$MERGED" -nobdcosm -nobdpos'

The Git Hub repo that you clone is used to create some wrappers that handle converting the file paths. It has something to do with relative versus absolute paths. I didn’t take the time to look into it further because it simply works. The source code is there so you can certainly satisfy your curiosity. It was written by Daniel Smith, so thank you Daniel!

Usage

As I mentioned, all the GUIs I have tried will recognize if you already have an external diff/merge tool defined in your gitconfig. You just need to figure out how to call the external tool from your GUI. Typically right-clicking on a file will give you an option to open it in an external diff tool. From the CLI, the commands you want are git difftool and git mergetool.

4 Comments on “Setting up LVCompare and LVMerge

  1. Hi Sam,

    Thanks you for the Git setup instructions, I wasn’t able to get it setup properly myself – and after seeing the vicompare repo it doesn’t look like I ever had a chance… Everything works except that the tools (at least the difftool) doesn’t seem to do anything different with or without the -nobdcosm -nobdpos flags. I get all of the cosmetic changes either way. Any idea how to fix this?

    Thanks,
    Aaron

    • I have since found an easier way that does not use the VISCC wrapper but instead uses a simple shell script to massage the paths. Here’s where I found it. https://github.com/JQIamo/SetList

      I am going to write a post about it, just haven’t gotten around to it yet.

        • Thanks for your help Sam. I did play around a little with the scripts in the SetList repo and it did work for me. I made the same global mods and just added the flags to the final exec command of the compare wrapper. Haven’t gotten around to try passing flags from the CLI.

Leave a Reply

Your email address will not be published. Required fields are marked *

*