diff mercurial/pushkey.py @ 43077:687b865b95ad

formatting: byteify all mercurial/ and hgext/ string literals Done with python3.7 contrib/byteify-strings.py -i $(hg files 'set:mercurial/**.py - mercurial/thirdparty/** + hgext/**.py - hgext/fsmonitor/pywatchman/** - mercurial/__init__.py') black -l 80 -t py33 -S $(hg files 'set:**.py - mercurial/thirdparty/** - "contrib/python-zstandard/**" - hgext/fsmonitor/pywatchman/**') # skip-blame mass-reformatting only Differential Revision: https://phab.mercurial-scm.org/D6972
author Augie Fackler <augie@google.com>
date Sun, 06 Oct 2019 09:48:39 -0400
parents 57875cf423c9
children d4ba4d51f85f
line wrap: on
line diff
--- a/mercurial/pushkey.py	Sun Oct 06 09:45:02 2019 -0400
+++ b/mercurial/pushkey.py	Sun Oct 06 09:48:39 2019 -0400
@@ -18,17 +18,17 @@
 def _nslist(repo):
     n = {}
     for k in _namespaces:
-        n[k] = ""
+        n[k] = b""
     if not obsolete.isenabled(repo, obsolete.exchangeopt):
-        n.pop('obsolete')
+        n.pop(b'obsolete')
     return n
 
 
 _namespaces = {
-    "namespaces": (lambda *x: False, _nslist),
-    "bookmarks": (bookmarks.pushbookmark, bookmarks.listbookmarks),
-    "phases": (phases.pushphase, phases.listphases),
-    "obsolete": (obsolete.pushmarker, obsolete.listmarkers),
+    b"namespaces": (lambda *x: False, _nslist),
+    b"bookmarks": (bookmarks.pushbookmark, bookmarks.listbookmarks),
+    b"phases": (phases.pushphase, phases.listphases),
+    b"obsolete": (obsolete.pushmarker, obsolete.listmarkers),
 }
 
 
@@ -59,13 +59,13 @@
 
 def encodekeys(keys):
     """encode the content of a pushkey namespace for exchange over the wire"""
-    return '\n'.join(['%s\t%s' % (encode(k), encode(v)) for k, v in keys])
+    return b'\n'.join([b'%s\t%s' % (encode(k), encode(v)) for k, v in keys])
 
 
 def decodekeys(data):
     """decode the content of a pushkey namespace from exchange over the wire"""
     result = {}
     for l in data.splitlines():
-        k, v = l.split('\t')
+        k, v = l.split(b'\t')
         result[decode(k)] = decode(v)
     return result