# HG changeset patch # User Matt Mackall # Date 1279139601 18000 # Node ID 944c23762c3ca6128f2f79082b0b9f3a612c8919 # Parent 26c7d4fc31bfb9d76320646973507b409ef3532b protocol: add proto to method prototypes diff -r 26c7d4fc31bf -r 944c23762c3c mercurial/wireproto.py --- a/mercurial/wireproto.py Wed Jul 14 15:25:15 2010 -0500 +++ b/mercurial/wireproto.py Wed Jul 14 15:33:21 2010 -0500 @@ -15,17 +15,17 @@ return False func, spec = commands[command] args = proto.getargs(spec) - proto.respond(func(repo, *args)) + proto.respond(func(repo, proto, *args)) return True -def between(repo, pairs): +def between(repo, proto, pairs): pairs = [map(bin, p.split("-")) for p in pairs.split(" ")] r = [] for b in repo.between(pairs): r.append(" ".join(map(hex, b)) + "\n") return "".join(r) -def branchmap(repo): +def branchmap(repo, proto): branchmap = repo.branchmap() heads = [] for branch, nodes in branchmap.iteritems(): @@ -34,24 +34,24 @@ heads.append('%s %s' % (branchname, ' '.join(branchnodes))) return '\n'.join(heads) -def branches(repo, nodes): +def branches(repo, proto, nodes): nodes = map(bin, nodes.split(" ")) r = [] for b in repo.branches(nodes): r.append(" ".join(map(hex, b)) + "\n") return "".join(r) -def heads(repo): +def heads(repo, proto): h = repo.heads() return " ".join(map(hex, h)) + "\n" -def listkeys(repo, namespace): +def listkeys(repo, proto, namespace): d = pushkey_.list(repo, namespace).items() t = '\n'.join(['%s\t%s' % (k.encode('string-escape'), v.encode('string-escape')) for k, v in d]) return t -def lookup(repo, key): +def lookup(repo, proto, key): try: r = hex(repo.lookup(key)) success = 1 @@ -60,7 +60,7 @@ success = 0 return "%s %s\n" % (success, r) -def pushkey(repo, namespace, key, old, new): +def pushkey(repo, proto, namespace, key, old, new): r = pushkey_.push(repo, namespace, key, old, new) return '%s\n' % int(r)