Thursday, January 17, 2013

Visual Studio 2012: Setup VisualHG, Mercurial, TortoiseHG and connect to Beanstalk

My current project is a Visual Studio 2008 C# application and I'm using Beanstalk to host the Mercurial repository.

Why Mercurial?
My lack of experience with git led me to Mercurial (aka hg on a *nix system). Mercurial simplifies the command set which, I'm hoping, will reduce the learning curve. Currently, only two people will be touching the source code and overlap should be minimal. I primarily need backup and versioning, merges will be rare.

VisualHG Installing on Visual Studio 2012 on Windows 8
The only real option out there as a Visual Studio plugin for Mercurial is VisualHG. There is a known bug installing with Visual Studio 2012, fix is discussed on the Discussion Board. Basically (after following the VisualHG install directions), you to tell VS to refresh itself by running this from a cmd prompt running as admin:

Windows Key + X -> Command Prompt (Admin)
C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\devenv /setup

Configure Mercurial to use Beanstalk
In order to use VisualHG, we have to install and setup Mercurial,TortoiseHg, and PuTTY. Beanstalk has a good guide for this.

The directions in the beanstalk guide are mostly sufficient but for pageant you want to put it in the startup folder.

If your not sure how to add things to the Startup folder in Windows 8, you aren't alone! Instructions here.

I made a shortcut on the desktop for pageant (right click pageant.exe, Send to-> Desktop), then copied the shortcup to the startup folder.

I also made a shortcut to AppData on my Favorites as I'll probably being in here quite a bit while writing apllications targeting the Windows desktop.

SSH Cache
I found one odd thing in the beanstalk guide, the last part regarding SSH Cache

You’ll need to store the Beanstalk host in your SSH cache. Perform this one-time step from the command line:
plink -ssh ssh://
Answer “Y” when SSH asks you to “Store key in cache?”

This doesn't work. What does work is (after cd to your PuTTY install directory):
plink -ssh
Where 'username' is the prefix of the url to your beanstalk account. should get you to your beanstalk page.

Connect to Beanstalk
The connection is actually managed by TortoiseHg and beanstalk has a good guide for this as well.

After following these guides I have my repository downloading from beanstalk!