Using the LVMerge Utility with TortoiseSVN:
When multiple developers are working on the same LabVIEW project, version control becomes crucial (that's where TortoiseSVN shines). Even with version control software and good developer communication, you'll eventually end up with two conflicting versions of the same VI. In this situation, being able to identify the changes each developer made to the original vi and choosing which modifications to keep is important, but it's tough to do this manually. This is exactly where LVMerge comes in!
The LabVIEW Merge utility provides a way to compare your version of a VI, another developer's conflicting VI, and the base version of the VI and, from these, to create a merged version that incorporates all the desired modifications. It was made available starting in LV8.5 and will work with any LV version after that. To configure it for use under SVN:
- Right click on a file to bring up the Tortoise context menu
- Find the "settings" entry in the context menu
- In the setting dialog there will be a category called "External Programs" under this category is an entry for "Merge Tool"
- Click "Advanced" to set up a specific merge command
- Add a new entry - extension should be ".vi" and the command is "C:\Program Files\National Instruments\Shared\LabVIEW Merge\LVMerge.exe %base %theirs %mine %merged" (without the quotes)
Actual usage of the Merge is a little more complicated:
- When you do a Commit on a file and someone else has already committed a modified version of the same file, you will get an error that your file is out of date and that you need to update your working copy.
- Next do an Update and you will get a message about a conflict and the conflicting file will get a special icon (yellow exclamation point).
- Right click this file and do an "Edit Conflicts". This will bring up the Merge utility (assuming you did everything above right). Note: when you start the Merge utility, it will try to open up the file with whatever version of LV was most recently running. If you try to perform a Merge on a file saved with a later version of LV than the one that you most recently used, you will get an error stating the file version is newer than the current LV version. To avoid this, just make sure you have the appropriate version of LV running before you start the Merge utility.
- Be careful, when you finish your merging and hit "close" it will attempt to save the result of the merge over your working copy. You will lose your working copy forever - which is fine, since the merge should have taken care of creating a replacement that incorporates your working copy changes.
- Finally, right click the file and hit "Resolved". Since the merge isn't directly integrated into SVN, it doesn't know that we have resolved the conflict and we have to tell it explicitly. In the Resolve window, do not hit OK, but instead right click on the file and choose "Resolved", and click Yes to confirm. (If you just hit OK then for some reason the normal resolve operation will generally have an error and fail, thus preventing you from committing the merged file).
- The merged file will now show up as modified, but should no longer be in a conflicted state. Do a Commit to add your new merged file into the Repo.
For National Instrument's discussion the details of actually using the Labview Merge Tool click here.