Saturday, October 23, 2010

Easier way to run Mercurial hgk (or hg view) on Windows (and Cygwin)

hgk, the Mercurial extension that allows the hg view command, is the graphical viewer for Mercurial repositories.

It's a bit messy to run it on Windows. The solution I came up with was easier than the others I found on the web, so ...

I downloaded the Mercurial 1.6.4 main binary for Windows (making sure to install the "contributed scripts" so that I got hgk), and ActiveState's ActiveTcl 8.4. I installed them. I then modified my Mercurial configuration as follows. You need to create one batch file in a directory of your choosing, in addition to installing these packages and modifying your configuration.

Added to Mercurial.ini (user or systemwide; probably would work with $HOME/.hgrc as well):

hgext.hgk =


Created hgk.bat (at path indicated above):
(Note that this is a two-line script: wish.exe takes the hgk path as an argument. Not sure how to get Blogger to format this better.)

@echo off
set HG=C:\path\to\mercurial\hg.exe
start C:\path\to\tcl\bin\wish.exe C:\path\to\mercurial\contrib\hgk %*

And that's it! I don't know why the official instructions are so hard. And in any case, they did not work for me. YMMV.

No comments:

Post a Comment