diff --git a/Library/Homebrew/download_strategy.rb b/Library/Homebrew/download_strategy.rb
index a319416bfe2ffea54ec2f3368cc945080387083d..766d21c9e55f35b58b15e811bb3fddee54fb4c86 100644
--- a/Library/Homebrew/download_strategy.rb
+++ b/Library/Homebrew/download_strategy.rb
@@ -220,7 +220,12 @@ class MercurialDownloadStrategy <AbstractDownloadStrategy
     url=@url.sub(%r[^hg://], '')
 
     unless @clone.exist?
-      safe_system 'hg', 'clone', url, @clone
+      checkout_args = []
+      if (@spec == :revision) and @ref
+        checkout_args << '-r' << @ref
+      end
+      checkout_args << url << @clone
+      safe_system 'hg', 'clone', *checkout_args
     else
       # TODO hg pull?
       puts "Repository already cloned"
diff --git a/Library/Homebrew/formula.rb b/Library/Homebrew/formula.rb
index 8c4614a3dd69373ec511a58d6966584896d64548..d76769bed49c64c2b156d6bc40f4394a7cd8d91a 100644
--- a/Library/Homebrew/formula.rb
+++ b/Library/Homebrew/formula.rb
@@ -165,6 +165,7 @@ class Formula
     when %r[^svn://] then SubversionDownloadStrategy
     when %r[^svn+http://] then SubversionDownloadStrategy
     when %r[^git://] then GitDownloadStrategy
+    when %r[^https?://(.+?\.)?googlecode\.com/hg] then MercurialDownloadStrategy
     when %r[^http://(.+?\.)?googlecode\.com/svn] then SubversionDownloadStrategy
     when %r[^http://(.+?\.)?sourceforge\.net/svnroot/] then SubversionDownloadStrategy
     when %r[^http://svn.apache.org/repos/] then SubversionDownloadStrategy