# HG changeset patch
# User Matt Mackall <mpm@selenic.com>
# Date 1326938448 21600
#      Wed Jan 18 20:00:48 2012 -0600
# Node ID f9fc46698352c5f7bdbd664a726db4a407cc66bd
# Parent  3f132207e92f283f6c9ad68c543a43852c13683f
wireproto: refuse to lookup secret csets

diff --git a/mercurial/wireproto.py b/mercurial/wireproto.py
--- a/mercurial/wireproto.py
+++ b/mercurial/wireproto.py
@@ -471,7 +471,11 @@
 
 def lookup(repo, proto, key):
     try:
-        r = hex(repo.lookup(encoding.tolocal(key)))
+        k = encoding.tolocal(key)
+        c = repo[k]
+        if c.phase() == phases.secret:
+            raise error.RepoLookupError(_("unknown revision '%s'") % k)
+        r = c.hex()
         success = 1
     except Exception, inst:
         r = str(inst)