Exemple #1
0
def pushkey(repo, proto, namespace, key, old, new):
    # compatibility with pre-1.8 clients which were accidentally
    # sending raw binary nodes rather than utf-8-encoded hex
    if len(new) == 20 and new.encode('string-escape') != new:
        # looks like it could be a binary node
        try:
            u = new.decode('utf-8')
            new = encoding.tolocal(new) # but cleanly decodes as UTF-8
        except UnicodeDecodeError:
            pass # binary, leave unmodified
    else:
        new = encoding.tolocal(new) # normal path

    r = pushkeymod.push(repo,
                        encoding.tolocal(namespace), encoding.tolocal(key),
                        encoding.tolocal(old), new)
    return '%s\n' % int(r)
Exemple #2
0
def pushkey(repo, proto, namespace, key, old, new):
    r = pushkeymod.push(repo, namespace, key, old, new)
    return "%s\n" % int(r)
def pushkey(repo, proto, namespace, key, old, new):
    r = pushkeymod.push(repo, namespace, key, old, new)
    return '%s\n' % int(r)