changeset 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 9209c02f1f25
children 64fe488b5179
files mercurial/exchange.py tests/test-bundle2.t
diffstat 2 files changed, 2 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/exchange.py	Thu Jul 24 14:29:08 2014 -0700
+++ b/mercurial/exchange.py	Wed Jul 02 16:13:48 2014 +0200
@@ -242,7 +242,8 @@
     replyhandlers = []
     for partgen in bundle2partsgenerators:
         ret = partgen(pushop, bundler)
-        replyhandlers.append(ret)
+        if callable(ret):
+            replyhandlers.append(ret)
     # do not push if nothing to push
     if bundler.nbparts <= 1:
         return
--- a/tests/test-bundle2.t	Thu Jul 24 14:29:08 2014 -0700
+++ b/tests/test-bundle2.t	Wed Jul 02 16:13:48 2014 +0200
@@ -957,7 +957,6 @@
   >     if reason == 'race':
   >         # 20 Bytes of crap
   >         bundler.newpart('b2x:check:heads', data='01234567890123456789')
-  >     return lambda op: None
   > 
   > @bundle2.parthandler("test:abort")
   > def handleabort(op, part):