Friday, August 17, 2007

MERGE WOES WITH .resx FILES

A few days back, I undertook the task of revamping the GUI of the application that I maintain. The application’s code has been written using VB.NET and Rational ClearCase (2003.06.10+) is the version control/change management tool for the same.


A branch (let’s call it GUI branch) was created off the main branch. The GUI enhancements were performed on this GUI branch. This involved addition of some new controls, changing the properties of some existing controls for one of the form (frmMain.vb) files in the project. After the ‘new and improved’ GUI was given a green, I was faced with the task of merging the GUI branch code with the main branch.


When I attempted to merge the files from GUI branch to main, I received a message to the effect - some of the conflicts could not be resolved by ClearCase, pl. do so via manual merge. The said message was received for the files frmMain.vb (code file) and frmMain.resx (resource file that is automatically generated by .NET). The conflicts in the code file I could resolve, but the .resx file had a large number of conflicts to be resolved (100+). I did complete the manual merge, but obviously I was not sure what I was doing.

Having completed the merge manually I was left w/ code that crashed on execution. That’s when I started searching the Internet high and dry for possible pointers to solving the problem I was facing. I was confident of finding abundant literature on the subject since what I had attempted to do wasn’t anything other-worldly, besides the tools involved were prominent too. I was surprised at not finding much help on the subject. Just as I was about to abandon my search and consider myself ClearCase cursed, I came across this article.


I decided to give KDiff3 a try. On comparing the two .resx files that I was trying to merge I noticed that some of the merge conflicts were due to the insertion of new tags in the middle of one of the files. Clearly if these tags were moved to the end, some of the merge conflicts would disappear.


Unlike ClearCase the merge conflicts in KDiff3 appeared simple to understand and thus resolve. I completed the manual merge of the .resx files via KDiff3. I used KDiff3 as a stand-alone tool and the process was clumsy (copying the .resx files to be merged on my local drive, merging and copying the result to the ClearCase repository). But I got my code to work and was able ship the build! KDiff3 has won my trust.


I must admit that I have not given enough thought about reconfiguring the default IBM® Rational® ClearCase® XML type manager to use KDiff3 when using ClearCase diff merge tools. Whether I will do that sometime soon, is doubtful (for reasons not worth mentioning here). However I wanted to document this mental note here.


To those of you who have come across situations like this and have figured out a work-around; I would like to hear from you.


Another approach that I took to solving this problem was to see if the .resx file would be generated automatically at compile time if it was deleted. In spite of the online reading and hands-on tweaks with .resx files, my understanding of them is still very hazy. Any pointers to understanding resx files will also be greatly appreciated.


On that note…. Tschuss erstmal!