wireproto: use proper UTF-8 handling for key lookup
authorMatt Mackall <mpm@selenic.com>
Wed, 24 Nov 2010 16:10:37 -0600
changeset 13049 d588326f6321
parent 13048 e298cca2d53a
child 13050 3790452d499b
wireproto: use proper UTF-8 handling for key lookup Lookups happen in the local encoding space, but the wire protocol should be using UTF-8 for interoperability.
mercurial/wireproto.py
--- a/mercurial/wireproto.py	Wed Nov 24 16:04:33 2010 -0600
+++ b/mercurial/wireproto.py	Wed Nov 24 16:10:37 2010 -0600
@@ -25,7 +25,7 @@
 class wirerepository(repo.repository):
     def lookup(self, key):
         self.requirecap('lookup', _('look up remote revision'))
-        d = self._call("lookup", key=key)
+        d = self._call("lookup", key=encoding.fromlocal(key))
         success, data = d[:-1].split(" ", 1)
         if int(success):
             return bin(data)
@@ -213,7 +213,7 @@
 
 def lookup(repo, proto, key):
     try:
-        r = hex(repo.lookup(key))
+        r = hex(repo.lookup(encoding.tolocal(key)))
         success = 1
     except Exception, inst:
         r = str(inst)