Live Fast, Code Hard, Die Young

Posts tagged ‘svn’

Using a cool merge tool with SVN or GIT

Here’s a little tip for those of you looking for a good diff/merge tool. It works quite well with both TortoiseSVN and Git Extensions and I’m sure it works with other applications as well.

Some of you may have heard of Perforce. It’s a pretty expensive source control system that is used by Google among others. I have never used it myself but I guess it’s ok. What I do know is that they have a great tool called P4Merge for merging and checking file differences. Best of all is that you can use it for free!

This is what a comparison looks like:

P4merge file comparison


To use P4Merge you need to install the Perforce Visual Client which is available as a free download from the Perforce download page. Make sure you get the right version for your system.

When you install it you can uncheck all the other tools and just install P4Merge:

P4merge installation

TortoiseSVN setup

To use P4Merge with TortoiseSVN you need open the TortoiseSVN settings and configure Diff Viewer and Merge Tool like this:

Diff Viewer:
“C:\Program Files\Perforce\p4merge.exe”  %base %mine

Merge Tool:
“C:\Program Files\Perforce\p4merge.exe” %base %theirs %mine %merged

Here’s how it looks for the Merge Tool setting:

TortoiseSVN settings

Git Extensions

It’s pretty easy to configure Git Extensions to use P4Merge. All you have to do is to open up the settings and choose “p4merge” in the Mergetool dropdown. The correct paths should be filled in automatically for you.

Git settings

That’s it – now you can enjoy a pretty nice tool for free!


Fixing the missing icons in TortoiseSVN


I’m using TortoiseSVN for source control both at work and at home. Lately I’ve been having some problems with it though because the icon overlays that show the status of files are not displayed. That kind of takes away one of the great features of the program so it quickly drove me nuts.

It turned out that it was not hard to fix. After some searching I found out that the problem is that Windows only supports a maximum of 15 registered overlay icons. Of those it uses 4 itself so that leaves us with 11 icons to play with. What happens if more icons are registered? Well, those extra icons are simply not shown. According to the TortoiseSVN FAQ this is taken into consideration when Tortoise is deciding which icons to use and I’ve never had any problems with it until now. Maybe it is not working as intended when running in Windows 7 (64-bit)?

So how does Windows decide which icons to use? Well there is a special key in the registry where everything can be found. It’s under HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\ShellIconOverlayIdentifiers.

This is how my registry looks:


Windows reads this list in alphabetical order which is kind of lame. I have some icons from Dropbox, some from Tortoise and some other that I suspect belong to Windows or Office. It seems that this list of 15 icons should work but it doesn’t. It’s more likely that only 11 of these icons are used because I’m missing the most common Tortoise icons (Modified and Normal) which happen to fall just outside the range.

The great part here is that each of these keys only contains a GUID which tells Windows where to lookup the actual icon information. In fact, we can change the names of the keys without breaking anything which gives us an easy way of rearranging the list!

This is a simple way of fixing it and making sure that the Tortoise icons gets a higher priority:


As you can see I renamed the icon identifiers and prefixed them using numbers which will ensure they are sorted before the other icons. I skipped the “TortoiseUnversioned” icon because it’s usually not of interest to me. Maybe I could skip some of the other icons too but I wanted to make sure it worked first.

After doing this little rename operation you have to restart your computer (yea, it’s Windows isn’t it?) and then the icons should show up nicely again. Quite sweet isn’t it…


It’s working! 🙂