Wednesday, June 13, 2012

Problems with VS 2010 Merge Tool?

I am currently working on a project where we have a team working on business features, while another team is working fulltime on upgrading the existing solution to html 5 and CSS 3 standards. Two teams are working independently in two branches; Dev Branch and UI branch. I was having a major issues when attempting to perform forward integration merges from Dev branch to UI branch as most of the .aspx, .ascx files in the UI branch are considerably changed! The layouts of the pages were significantly changed as the team has replaced the ALL existing HTML tables with divs. Entire style pages changed.  I was having a nightmare trying to merge such enormously changed files using the default merge tool provided in VS 2010, which tries to be smart, and come out useless! Default Merge tool has several notable drawbacks,


·         The major problem is that it attempts to be smart!  It allows me to select between two large chucks of code, of which I cannot simply select. The required changes exist in both chunks and hence I am left with no option, but to select one chunk of code and manually edit. Sometimes this chunk could contain few hundred lines!
·         It doesn’t explicitly display the exact difference in the comparing files
·         No easy way of identifying spaces
·         Find operation has less options. (Cannot limit the operation to a given set of windows)
·         Does not display from which file the output file lines were taken. (Would like to see the source file in each line)
·         Does not explicitly display areas I manually changed!
·         I don’t get to see the “Original Version”
·         Look and feel is boring!


The solution to this problem is simple. Just change your default merge tool in VS 2010. I changed it to KDiff3. Pretty much all my problems were resolved! Merging code turned out be “Fun” again! I started code merging every day! Yeah, it was a fairy tale ending!!!

Anyways, changing the default Merge tool is very easy. There are so many blog posts like this explaining the procedure with screen shots. There are many free open source and paid Merge Tools and you can configure VS to work with any Merge Tool of your choice. All you need to do is install the new Merge Tool and configure it in VS 2010 for both MERGING and COMPARING using proper arguments. Yes, the tricky part is – where can we find the arguments? Fortunately James Manning has a nice blog post explaining how arguments need to be passed for various merge tools. So if you have problems with your VS default merge tool – Simply get rid of it! 

No comments: