Posts Tagged ‘mercurial’

Get “hg view” to work in Mac OS X

Wednesday, February 6th, 2008

I finally wanted to make hg view work.

When I downloaded a Mac OS X installer for Mercurial I noticed that the hgk extension (invoked by hg view) didn't work out of the box. No big deal right away.

Today I wanted to use it though!

Here's how to get it to work:

  1. Download and install a new version of Mercurial using the link above.

  2. Clone the Mercurial repository, then update it to the revision that you had just installed, and finally copy the hgk script to your personal bin directory:

    $ hg clone http://selenic.com/hg hg-upstream
    $ hg up -r b7f44f01a632
    $ cp hg-upstream/contrib/hgk ~/bin
    

    You could also copy it to your system-wide bin directory:

    $ sudo cp hg-upstream/contrib/hgk /usr/local/bin
    
  3. Edit your ~/.hgrc file to turn on the extension and point it to the location of your hgk script:

    [extensions]
    hgk=
    
    [hgk]
    path=/Users/myusername/bin/hgk
    

    (If you copied it to your system-wide bin directory, use /usr/local/bin/hgk for the path value.)

Two ways to install Mercurial on Mac OSX Leopard

Thursday, January 31st, 2008

I'm back on the OSX platform, using Leopard, even. After a four-month absence, all of the keyboard shortcuts are coming back to me quickly. (The most disruptive I think is the distinction between switching between apps and switching between different windows of the same app.) I'm still within the first 24 hours of installing software and making it "home".

One of the pieces of software I needed to install was Mercurial. I quickly found out that, like many tools ported from elsewhere in the Linux/BSD/etc world, there is more than one way to install the same thing. :)

Install using a native installer

This is the easiest method, because, if you're using Leopard, it's one download and one package installation away.

http://mercurial.berkwood.com/ is a great resource. Scroll down past the Windows section and you will find instructions for Tiger users who haven't yet installed Python 2.5.1. Following that, you will find prepackaged installers for Mercurial, including recent fixes beyond the 0.9.5 release version.

Download the ZIP file you want, open it to extract it (Safari does that part for you), then open the installer (you can right-click in Safari then choose Open). Follow all the usual steps.

Now you can open Terminal and run hg --version to make sure it's installed. Running which hg should return /usr/local/bin/hg for this type of installation.

Install using MacPorts

This method is a little more involved, because you need to first download and install MacPorts, which involves making sure you have the latest Xcode installed. You may have already installed such things if you are a "power user".

Once you have MacPorts set up, run sudo port -v install mercurial from within a Terminal window. It takes several minutes for it to download and install all of the prerequisites that it needs.

When it's done, as noted above, you can use hg --version to make sure it's installed. Running which hg should return /opt/local/bin/hg.

Time slipped away…

Tuesday, January 22nd, 2008

... as I created Slipper last night.

Today, 0.1a1 came to fruition!

That was a lot of fun, and part of my geeky repository-as-documentation-website dreams have come true!

Backporting mercurial 0.9.5 to Ubuntu 7.10 “Gutsy”

Friday, January 11th, 2008

I've fallen in love with Mercurial. It's used by projects and people that I respect, and I'm using it more and more.

I wanted to make sure I was using the latest version, but I didn't want to uninstall gutsy's version 0.9.4 and install it from source, nor did I want to upgrade my entire system to hardy. I've played around with such bleeding-edge things in the past, and while I still like to bleed sometimes, the Linux desktop is not one of those areas in which I desire to. :)

So, what to do?

Fortunately, it's easy to backport it from hardy. Here's what I did:

  1. $ vim /etc/apt/sources.list

  2. Add this line to the end:

    deb-src http://us.archive.ubuntu.com/ubuntu/ \
        hardy main restricted universe multiverse
    
  3. Save and exit.

  4. $ sudo apt-get update

  5. $ sudo apt-get build-dep mercurial

  6. $ fakeroot apt-get source -b mercurial

  7. $ sudo dpkg -i mercurial_0.9.5-2_i386.deb

Lather, rinse, then repeat steps 4 through 7 as necessary if you're anxious. Or, just wait three months for hardy. :)

Patch for hg.setuptools to play nice in a virtualenv

Monday, January 7th, 2008

I am using Mercurial to manage the source for some of my newer projects, and hg.setuptools caught my attention as something that would be very useful. I'm used to having the same functionality using Subversion, that is to say, I'm used to setuptools figuring out what files it should include with a distribution based on whether or not they're in the repository.

I use virtualenv to manage my development environments, and I found that when using hg.setuptools 0.2 out of the box, I'd get errors such as the following:

  File "/var/lib/python-support/python2.5/mercurial/demandimport.py", line 70, in __call__
    raise TypeError("'unloaded module' object is not callable")
TypeError: 'unloaded module' object is not callable

I ran across a note that mentioned disabling demandimport, so that is what I did with hg.setuptools. I uploaded a patch that made it work for me. If you're having the same problem, I hope it works for you too!