Aug
28

Using new LabVIEW Merge Tool LVMerge With TortoiseSVN

by Tomi Maila, Aug 28, 2007 at 6:30 am
1 Star2 Stars3 Stars4 Stars5 Stars (4 votes, average: 5 out of 5)
Loading ... Loading ...

LabVIEW 8.5 includes a new visual merge tool LVMerge that can be called from external source code control program for three-way VI merging. I’ll go trough the steps required to integrate LVMerge with popular TortoiseSVN source code control client.

If you have edited a VI that is under source code control, occasionally someone else may have edited the same VI after you have checked it out. As a result the two versions of the same VI are likely differ from each other. In three-way merging, these two different versions of the VI are compared agains a common base version of the VI. This way the merge tool can identify which of the changes have occured in both of the modified version since the VI was last checked out. LVMerge is a three-way merge tool and allows developers to visually compare all three versions of the VI. For each modification in either of the two modified version of the VI developer can choose if the modification should be ignored or included.

Setting up TortoiseSVN

To set up LVMerge with TortoiseSVN, right click on a directory under souce code control and select TortoiseSVN from the right-click menu and and then Settings from the appearing submenu. TortoiseSVN Settings screen will open.

TortoiseSVN Settings

Select Merge Tool from the tree menu on the left and press Advanced… button on the right to open the advanced merge tool settings.

Advanced LVMerge settings

No, let’s define that files with extension .vi shall be merged with LVMerge. Tio do this, click Add… button. A dialog window with two fields Extension and External Program will appear.

Extension specific merge program

For the Extension field fill in

.vi

For the External Program field fill in

“C:\Program Files\National Instruments\Shared\LabVIEW Merge\LVMerge.exe” “C:\Program Files\National Instruments\LabVIEW 8.5\LabVIEW.exe” %base %theirs %mine %merged

If your LabVIEW installation directory is not under C:\Program Files\National Instruments, mofify the path respectively.

Press Ok for all the open windows and you are done setting things up.

Accessing LVMerge to Resolve Conflicts

Now we are ready to resolve conflicted VIs. When TortoiseSVN encounters a conflict, it layouts a exclamation point on top of the file icon on windows explorer. The exclamation point indicates that the file is conflicted and that you need to manually resolve the conflicts.

Conflicted item

To resolve the conflicts, right click on the conflicted file and select TortoiseSVNand Edit conflictsfrom the appearing context menu. Now TortoiseSVN will call LVMerge to allow you to resolve the conflicts. LVMerge is a rather intuitive tool and I’ll not go into detail how to use it. You’ll come along.

After you are done with resolving conflicts, save the file with the proposed name and quit LVMerge. TortoiseSVN doesn’t automatically know that the conflicts are now resolved but you still need to thell this to TortoiseSVN. You can tell TortoiseSVN that all conflicts are now resolved by selecting TortoiseSVNand Resolvedfrom the right click menu of the conflicted file. After you have resolved all conflicts in your project, you can commit your changes to the repository.

Note! When resolving conflicts this way, the merged version gets saved on top of your own version of the VI. If you make mistakes in the merge process, you may accidentally loose your own changes to the VI. This is a feature of TortoiseSVN.

Don’t forget to read Jim Kring’s recent post Using Beyond Compare as your TortoiseSVN Diff Program for ZIP Archives at Thinking in G.

Print This Post Print This Post

13 Comments

Make A Comment
  • Valdeane W. Brown Said:

    Just a couple of typos - “sips of the flingers” as I like to call them. But, besides those few “glitches” it’s a very good explanation. I’m wanting to begin using SVN but, having had a rather bad prior experience, have become very cautious. Knowing how easily the LVMerge tool can be integrated into SVN makes me feel more confident that migrating to SCC under SVN will actually work. Thanks for the tips!

  • Tomi Maila Said:

    We’ve been using SVN for a couple of months now. There has been some difficulties but compared to situation when we didn’t use SCC I guarantee it’s a big improvement.

    We initially used an older version of subversion server that already was provided as a service by our University. It seems that there was a bug in this version of subversion that caused troubles when committing large LabVIEW projects; the server freezed due to memory leakage. So use the latest version of subversion only.

    Furthermore resolving conflicts with LabVIEW class files in not always straight forward. The class files are XML documents with some binary encoded content. TortoiseSVN can merge the non-binary content but not the binary content. I’d love to see that LVMerge would be extended to all LabVIEW file types, not only VIs.

  • Jaegen Said:

    A couple comments:

    * I couldn’t get this to work with the command line you listed (Tortoise displays an error dialog saying it can’t find the file specified). I managed to get it to work using “C:\Program Files\National Instruments\Shared\LabVIEW Merge\LVMerge.exe %base %theirs %mine %merged” (no quotes).
    * Why can’t I get a lock on a VI that has conflicts? This makes this almost useless, unless we take the leap of removing the “needslock” property. The merge tool works great, but when it comes time to save the VI, I can’t (since it’s locked and therefore read-only), and Tortoise won’t let me get a lock on it (if I select “Get Lock”, the “Lock Files” dialog file list is empty).

  • Andy Hull Said:

    Was successful in getting SVN merge to work with a subset of the command line (i.e. comment #3) and worked extremely well. It would be nice to see LVMerge expanded to all NI file types.

    One thing I have been trying to get to work also is the compare feature. It appears to work diffrently than the LVmerge feature. Is there a way to setup the compare feature in SVN also?

  • Tomi Maila Said:

    Regarding the compare tool, there is not command line counterpart. One can naturally try to write a wrapper for the compare utility that ships with LabVIEW 8.5 professional that could be accessed from command line. However it may not be trivial…

  • Tim Streeter Said:

    If you want to do a LabVIEW compare you should check out MetaDiff.

    http://meta-diff.sourceforge.net/

    I have used the LVdiff tool successfully with SVN.

    When NI finally send us our copy of LV8.5 I will finally have a complete suite of tools that work with subversion.

  • Tomi Maila Said:

    “C:\Program Files\National Instruments\Shared\LabVIEW Merge\LVMerge.exe” “C:\Program Files\National Instruments\LabVIEW 8.5\LabVIEW.exe” %base %theirs %mine %merged

    The above command line works for me. I guess the blog editor has changed the double quotes I used into some unicode characters that are not actually ascii versions of the double quotes.

  • Richard Herzog Said:

    Thanks for your help which allowed me to install LVmerge & LVdiff in TortoiseSVN.
    I have a basic query: everytime a Vi is moved location (like in checking out to a new user/location), it is recompiled and marked “modified”, hence every checkout can potentially generate a new revision?! How to avoid this very confusing LabView “feature”.

  • Jody Koplo Said:

    Used the command line that was suggested by Jaegen in comment #3. Works amazingly well. I am impressed.

  • Michael Said:

    I get the following after resolving conflicts:

    Error: An unknown error occurred while accessing H:\SVN Sandbox2\asdf.vi.
    Resolved: H:\SVN Sandbox2\asdf.vi

    Anyone else get the same? The conflicts are resolved, I’m able to Commit, everything is fine, I’m just curious if that error means anything and if others see the same.

  • Dannyt Said:

    Hi,

    If you were programming in LabVIEW 8.2.1 but had LabVIEW 8.5 installed on your machine would the LVMerge.exe still work in that situation, or do you have to actually be working in LabVIEW 8.5 ?

    just curious really

    cheers

    Danny

  • Arranny Said:

    LVMerge works pretty well, but somehow after I finish editing my conflicts, I cannot set my file to resolved using tortoise. I get the following error:
    Error: An unknown error occurred while accessing C:\Development\TestRepository\RandomNumberDisplay.vi.

    Anyone else experience the same? For non-labview files, resolving conflicts is fine.

  • Franz Said:

    Hi Arranny, I get the same error as you, i.e. I can’t use the ‘Conflict resolved…’ feature of TortoiseSVN.

    As a workaround I (after merging) manually deleted the files ‘test.vi.r8′ and ‘test.vi.r9′. Then the menu entry ‘Conflict resolved…’ is not available any more, but I can do a normal ‘SVN Commit’ and all seems to be fine.
    I don’t know if there are side effects, however.
    (BTW, I use Tortoise 1.5.2, while Tomi Maila’s originally posted his recipe when version 1.5.x was not out yet)

Comments RSS Feed   TrackBack URL

Leave a comment