mercurial/pushkey.py
changeset 21659 a319842539f5
parent 21652 ed6e61eaebc0
child 21661 2f52a16f2bee
equal deleted inserted replaced
21658:0696ca0a685b 21659:a319842539f5
    35 def list(repo, namespace):
    35 def list(repo, namespace):
    36     '''return a dict'''
    36     '''return a dict'''
    37     lk = _get(namespace)[1]
    37     lk = _get(namespace)[1]
    38     return lk(repo)
    38     return lk(repo)
    39 
    39 
       
    40 decode = encoding.tolocal
       
    41 
    40 def encodekeys(keys):
    42 def encodekeys(keys):
    41     """encode the content of a pushkey namespace for exchange over the wire"""
    43     """encode the content of a pushkey namespace for exchange over the wire"""
    42     enc = encoding.fromlocal
    44     enc = encoding.fromlocal
    43     return '\n'.join(['%s\t%s' % (enc(k), enc(v)) for k, v in keys])
    45     return '\n'.join(['%s\t%s' % (enc(k), enc(v)) for k, v in keys])
    44 
    46 
    45 def decodekeys(data):
    47 def decodekeys(data):
    46     """decode the content of a pushkey namespace from exchange over the wire"""
    48     """decode the content of a pushkey namespace from exchange over the wire"""
    47     result = {}
    49     result = {}
    48     for l in data.splitlines():
    50     for l in data.splitlines():
    49         k, v = l.split('\t')
    51         k, v = l.split('\t')
    50         result[encoding.tolocal(k)] = encoding.tolocal(v)
    52         result[decode(k)] = decode(v)
    51     return result
    53     return result