comparison mercurial/exchange.py @ 21941:dab31290c7eb stable

bundle2: only use callable return as reply handler When a bundle2 parts generator returns a non callable value, it should not be used as a reply handler. The changegroup part generator is already having this case of behavior when there is no changegroup to push. This changeset prevent a crash for user of the experimentable bundle2 feature.
author Pierre-Yves David <pierre-yves.david@fb.com>
date Wed, 02 Jul 2014 16:13:48 +0200
parents 08dcb572a456
children bdb6d97f0a04
comparison
equal deleted inserted replaced
21940:9209c02f1f25 21941:dab31290c7eb
240 capsblob = bundle2.encodecaps(pushop.repo.bundle2caps) 240 capsblob = bundle2.encodecaps(pushop.repo.bundle2caps)
241 bundler.newpart('b2x:replycaps', data=capsblob) 241 bundler.newpart('b2x:replycaps', data=capsblob)
242 replyhandlers = [] 242 replyhandlers = []
243 for partgen in bundle2partsgenerators: 243 for partgen in bundle2partsgenerators:
244 ret = partgen(pushop, bundler) 244 ret = partgen(pushop, bundler)
245 replyhandlers.append(ret) 245 if callable(ret):
246 replyhandlers.append(ret)
246 # do not push if nothing to push 247 # do not push if nothing to push
247 if bundler.nbparts <= 1: 248 if bundler.nbparts <= 1:
248 return 249 return
249 stream = util.chunkbuffer(bundler.getchunks()) 250 stream = util.chunkbuffer(bundler.getchunks())
250 try: 251 try: