comparison mercurial/wireproto.py @ 11623:31d0a6d50ee2

protocol: extract compression from streaming mechanics
author Dirkjan Ochtman <dirkjan@ochtman.nl>
date Fri, 16 Jul 2010 22:20:10 +0200
parents 1d48681b17a4
children cdeb861335d5
comparison
equal deleted inserted replaced
11622:1d48681b17a4 11623:31d0a6d50ee2
171 return ' '.join(caps) 171 return ' '.join(caps)
172 172
173 def changegroup(repo, proto, roots): 173 def changegroup(repo, proto, roots):
174 nodes = decodelist(roots) 174 nodes = decodelist(roots)
175 cg = repo.changegroup(nodes, 'serve') 175 cg = repo.changegroup(nodes, 'serve')
176 proto.sendchangegroup(cg) 176 proto.sendstream(proto.groupchunks(cg))
177 177
178 def changegroupsubset(repo, proto, bases, heads): 178 def changegroupsubset(repo, proto, bases, heads):
179 bases = decodelist(bases) 179 bases = decodelist(bases)
180 heads = decodelist(heads) 180 heads = decodelist(heads)
181 cg = repo.changegroupsubset(bases, heads, 'serve') 181 cg = repo.changegroupsubset(bases, heads, 'serve')
182 proto.sendchangegroup(cg) 182 proto.sendstream(proto.groupchunks(cg))
183 183
184 def heads(repo, proto): 184 def heads(repo, proto):
185 h = repo.heads() 185 h = repo.heads()
186 return encodelist(h) + "\n" 186 return encodelist(h) + "\n"
187 187
213 def pushkey(repo, proto, namespace, key, old, new): 213 def pushkey(repo, proto, namespace, key, old, new):
214 r = pushkey_.push(repo, namespace, key, old, new) 214 r = pushkey_.push(repo, namespace, key, old, new)
215 return '%s\n' % int(r) 215 return '%s\n' % int(r)
216 216
217 def stream(repo, proto): 217 def stream(repo, proto):
218 try: 218 proto.sendstream(streamclone.stream_out(repo))
219 proto.sendstream(streamclone.stream_out(repo))
220 except streamclone.StreamException, inst:
221 return str(inst)
222 219
223 def unbundle(repo, proto, heads): 220 def unbundle(repo, proto, heads):
224 their_heads = decodelist(heads) 221 their_heads = decodelist(heads)
225 222
226 def check_heads(): 223 def check_heads():