diff -r b3b4c487707c -r 53865692a354 mercurial/wireproto.py --- a/mercurial/wireproto.py Mon Mar 13 09:24:53 2017 -0700 +++ b/mercurial/wireproto.py Wed Mar 15 23:06:50 2017 +0900 @@ -900,7 +900,7 @@ def pushkey(repo, proto, namespace, key, old, new): # compatibility with pre-1.8 clients which were accidentally # sending raw binary nodes rather than utf-8-encoded hex - if len(new) == 20 and new.encode('string-escape') != new: + if len(new) == 20 and util.escapestr(new) != new: # looks like it could be a binary node try: new.decode('utf-8')