Mercurial > public > mercurial-scm > hg
diff mercurial/hgweb/protocol.py @ 11584:1af96b090116
protocol: unify changegroup commands
- add sendchangegroup protocol helpers
- handle commands with None results
- move changegroup commands into wireproto.py
author | Matt Mackall <mpm@selenic.com> |
---|---|
date | Wed, 14 Jul 2010 15:43:20 -0500 |
parents | 26c7d4fc31bf |
children | 5d907fbb9703 |
line wrap: on
line diff
--- a/mercurial/hgweb/protocol.py Wed Jul 14 15:33:21 2010 -0500 +++ b/mercurial/hgweb/protocol.py Wed Jul 14 15:43:20 2010 -0500 @@ -23,43 +23,6 @@ HGTYPE = 'application/mercurial-0.1' basecaps = 'lookup changegroupsubset branchmap pushkey'.split() -def changegroup(repo, req): - req.respond(HTTP_OK, HGTYPE) - nodes = [] - - if 'roots' in req.form: - nodes = map(bin, req.form['roots'][0].split(" ")) - - z = zlib.compressobj() - f = repo.changegroup(nodes, 'serve') - while 1: - chunk = f.read(4096) - if not chunk: - break - yield z.compress(chunk) - - yield z.flush() - -def changegroupsubset(repo, req): - req.respond(HTTP_OK, HGTYPE) - bases = [] - heads = [] - - if 'bases' in req.form: - bases = [bin(x) for x in req.form['bases'][0].split(' ')] - if 'heads' in req.form: - heads = [bin(x) for x in req.form['heads'][0].split(' ')] - - z = zlib.compressobj() - f = repo.changegroupsubset(bases, heads, 'serve') - while 1: - chunk = f.read(4096) - if not chunk: - break - yield z.compress(chunk) - - yield z.flush() - def capabilities(repo, req): caps = copy.copy(basecaps) if streamclone.allowed(repo.ui):