diff --git a/mercurial/exchange.py b/mercurial/exchange.py --- a/mercurial/exchange.py +++ b/mercurial/exchange.py @@ -1421,6 +1421,11 @@ def getbundle2partsgenerator(stepname, i return func return dec +def bundle2requested(bundlecaps): + if bundlecaps is not None: + return any(cap.startswith('HG2') for cap in bundlecaps) + return False + def getbundle(repo, source, heads=None, common=None, bundlecaps=None, **kwargs): """return a full bundle (with potentially multiple kind of parts) @@ -1436,10 +1441,8 @@ def getbundle(repo, source, heads=None, The implementation is at a very early stage and will get massive rework when the API of bundle is refined. """ + usebundle2 = bundle2requested(bundlecaps) # bundle10 case - usebundle2 = False - if bundlecaps is not None: - usebundle2 = any((cap.startswith('HG2') for cap in bundlecaps)) if not usebundle2: if bundlecaps and not kwargs.get('cg', True): raise ValueError(_('request for bundle10 must include changegroup'))