Mercurial > hg-stable
changeset 21659:a319842539f5
pushkey: add a ``decode`` function
This function is just a shorthand for ``decoding.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:23:25 -0700 |
parents | 0696ca0a685b |
children | e87d2a12d41b |
files | mercurial/pushkey.py |
diffstat | 1 files changed, 3 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/pushkey.py Tue May 27 15:44:46 2014 -0700 +++ b/mercurial/pushkey.py Thu May 29 15:23:25 2014 -0700 @@ -37,6 +37,8 @@ lk = _get(namespace)[1] return lk(repo) +decode = encoding.tolocal + def encodekeys(keys): """encode the content of a pushkey namespace for exchange over the wire""" enc = encoding.fromlocal @@ -47,5 +49,5 @@ result = {} for l in data.splitlines(): k, v = l.split('\t') - result[encoding.tolocal(k)] = encoding.tolocal(v) + result[decode(k)] = decode(v) return result