# HG changeset patch # User Boris Feld # Date 2018-01-31 08:41:47 # Node ID 66c0ff381cfc45e06fd7bf2103d6ff41e26d3122 # Parent 68fcc5503ec55bda2d6be2887f8fc3f61000c666 bundle: condition the changegroup part when creating a new bundle We will generate stream bundle in the next changesets which doesn't need the changegroup part. Differential Revision: https://phab.mercurial-scm.org/D1951 diff --git a/mercurial/bundle2.py b/mercurial/bundle2.py --- a/mercurial/bundle2.py +++ b/mercurial/bundle2.py @@ -1577,19 +1577,21 @@ def _addpartsfromopts(ui, repo, bundler, # different right now. So we keep them separated for now for the sake of # simplicity. - # we always want a changegroup in such bundle - cgversion = opts.get('cg.version') - if cgversion is None: - cgversion = changegroup.safeversion(repo) - cg = changegroup.makechangegroup(repo, outgoing, cgversion, source) - part = bundler.newpart('changegroup', data=cg.getchunks()) - part.addparam('version', cg.version) - if 'clcount' in cg.extras: - part.addparam('nbchanges', '%d' % cg.extras['clcount'], - mandatory=False) - if opts.get('phases') and repo.revs('%ln and secret()', - outgoing.missingheads): - part.addparam('targetphase', '%d' % phases.secret, mandatory=False) + # we might not always want a changegroup in such bundle, for example in + # stream bundles + if opts.get('changegroup', True): + cgversion = opts.get('cg.version') + if cgversion is None: + cgversion = changegroup.safeversion(repo) + cg = changegroup.makechangegroup(repo, outgoing, cgversion, source) + part = bundler.newpart('changegroup', data=cg.getchunks()) + part.addparam('version', cg.version) + if 'clcount' in cg.extras: + part.addparam('nbchanges', '%d' % cg.extras['clcount'], + mandatory=False) + if opts.get('phases') and repo.revs('%ln and secret()', + outgoing.missingheads): + part.addparam('targetphase', '%d' % phases.secret, mandatory=False) addparttagsfnodescache(repo, bundler, outgoing) addpartrevbranchcache(repo, bundler, outgoing) diff --git a/mercurial/commands.py b/mercurial/commands.py --- a/mercurial/commands.py +++ b/mercurial/commands.py @@ -1263,7 +1263,7 @@ def bundle(ui, repo, fname, dest=None, * compopts['level'] = complevel - contentopts = {'cg.version': cgversion} + contentopts = {'cg.version': cgversion, 'changegroup': True} if repo.ui.configbool('experimental', 'evolution.bundle-obsmarker'): contentopts['obsolescence'] = True if repo.ui.configbool('experimental', 'bundle-phases'):