mirror of
https://github.com/facebook/sapling.git
synced 2025-01-08 14:46:47 +03:00
pushkey: add an `encode
` function
This function is just a shorthand for ``encoding.fromlocal``. It will help hiding the encoding business from other code exchanging pushkey data over the wire.
This commit is contained in:
parent
f7baff1111
commit
c961ed1664
@ -37,12 +37,13 @@ def list(repo, namespace):
|
||||
lk = _get(namespace)[1]
|
||||
return lk(repo)
|
||||
|
||||
encode = encoding.fromlocal
|
||||
|
||||
decode = encoding.tolocal
|
||||
|
||||
def encodekeys(keys):
|
||||
"""encode the content of a pushkey namespace for exchange over the wire"""
|
||||
enc = encoding.fromlocal
|
||||
return '\n'.join(['%s\t%s' % (enc(k), enc(v)) for k, v in keys])
|
||||
return '\n'.join(['%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"""
|
||||
|
Loading…
Reference in New Issue
Block a user