mercurial/wireproto.py
changeset 14064 e4bfb9c337f3
parent 14048 58e58406ed19
child 14093 ce99d887585f
equal deleted inserted replaced
14063:87ebf72878ed 14064:e4bfb9c337f3
   294     # compatibility with pre-1.8 clients which were accidentally
   294     # compatibility with pre-1.8 clients which were accidentally
   295     # sending raw binary nodes rather than utf-8-encoded hex
   295     # sending raw binary nodes rather than utf-8-encoded hex
   296     if len(new) == 20 and new.encode('string-escape') != new:
   296     if len(new) == 20 and new.encode('string-escape') != new:
   297         # looks like it could be a binary node
   297         # looks like it could be a binary node
   298         try:
   298         try:
   299             u = new.decode('utf-8')
   299             new.decode('utf-8')
   300             new = encoding.tolocal(new) # but cleanly decodes as UTF-8
   300             new = encoding.tolocal(new) # but cleanly decodes as UTF-8
   301         except UnicodeDecodeError:
   301         except UnicodeDecodeError:
   302             pass # binary, leave unmodified
   302             pass # binary, leave unmodified
   303     else:
   303     else:
   304         new = encoding.tolocal(new) # normal path
   304         new = encoding.tolocal(new) # normal path