Mercurial > hg-stable
changeset 21661:2f52a16f2bee
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.
author | Pierre-Yves David <pierre-yves.david@fb.com> |
---|---|
date | Thu, 29 May 2014 15:22:58 -0700 |
parents | e87d2a12d41b |
children | 09f19e09f1b4 |
files | mercurial/pushkey.py |
diffstat | 1 files changed, 3 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/pushkey.py Tue May 27 16:32:50 2014 -0700 +++ b/mercurial/pushkey.py Thu May 29 15:22:58 2014 -0700 @@ -37,12 +37,13 @@ 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"""