# HG changeset patch # User Pierre-Yves David # Date 2014-07-02 14:13:48 # Node ID dab31290c7ebdaafadfdb574d37c3285fdc7795f # Parent 9209c02f1f2548045f37f4a0f617723079503028 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. diff --git a/mercurial/exchange.py b/mercurial/exchange.py --- a/mercurial/exchange.py +++ b/mercurial/exchange.py @@ -242,7 +242,8 @@ def _pushbundle2(pushop): 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 diff --git a/tests/test-bundle2.t b/tests/test-bundle2.t --- a/tests/test-bundle2.t +++ b/tests/test-bundle2.t @@ -957,7 +957,6 @@ Setting up > 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):