mercurial/wireproto.py
changeset 37538 89fed81bbb6c
parent 37537 be5d4749edc0
child 37539 4a0d58d6faba
--- a/mercurial/wireproto.py	Fri Apr 06 17:39:40 2018 -0700
+++ b/mercurial/wireproto.py	Fri Apr 06 17:48:07 2018 -0700
@@ -1120,7 +1120,8 @@
     d = sorted(repo.listkeys(encoding.tolocal(namespace)).items())
     return wireprototypes.bytesresponse(pushkeymod.encodekeys(d))
 
-@wireprotocommand('lookup', 'key', permission='pull')
+@wireprotocommand('lookup', 'key', permission='pull',
+                  transportpolicy=POLICY_V1_ONLY)
 def lookup(repo, proto, key):
     try:
         k = encoding.tolocal(key)
@@ -1378,6 +1379,20 @@
 
     return wireprototypes.cborresponse(keys)
 
+@wireprotocommand('lookup',
+                  args={
+                      'key': b'foo',
+                  },
+                  permission='pull',
+                  transportpolicy=POLICY_V2_ONLY)
+def lookupv2(repo, proto, key):
+    key = encoding.tolocal(key)
+
+    # TODO handle exception.
+    node = repo.lookup(key)
+
+    return wireprototypes.cborresponse(node)
+
 @wireprotocommand('pushkey',
                   args={
                       'namespace': b'ns',