comparison mercurial/bundle2.py @ 37005:66c0ff381cfc

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
author Boris Feld <boris.feld@octobus.net>
date Wed, 31 Jan 2018 09:41:47 +0100
parents 2090044a288d
children f0b6fbea00cf
comparison
equal deleted inserted replaced
37004:68fcc5503ec5 37005:66c0ff381cfc
1575 # 1575 #
1576 # The type of input from 'getbundle' and 'writenewbundle' are a bit 1576 # The type of input from 'getbundle' and 'writenewbundle' are a bit
1577 # different right now. So we keep them separated for now for the sake of 1577 # different right now. So we keep them separated for now for the sake of
1578 # simplicity. 1578 # simplicity.
1579 1579
1580 # we always want a changegroup in such bundle 1580 # we might not always want a changegroup in such bundle, for example in
1581 cgversion = opts.get('cg.version') 1581 # stream bundles
1582 if cgversion is None: 1582 if opts.get('changegroup', True):
1583 cgversion = changegroup.safeversion(repo) 1583 cgversion = opts.get('cg.version')
1584 cg = changegroup.makechangegroup(repo, outgoing, cgversion, source) 1584 if cgversion is None:
1585 part = bundler.newpart('changegroup', data=cg.getchunks()) 1585 cgversion = changegroup.safeversion(repo)
1586 part.addparam('version', cg.version) 1586 cg = changegroup.makechangegroup(repo, outgoing, cgversion, source)
1587 if 'clcount' in cg.extras: 1587 part = bundler.newpart('changegroup', data=cg.getchunks())
1588 part.addparam('nbchanges', '%d' % cg.extras['clcount'], 1588 part.addparam('version', cg.version)
1589 mandatory=False) 1589 if 'clcount' in cg.extras:
1590 if opts.get('phases') and repo.revs('%ln and secret()', 1590 part.addparam('nbchanges', '%d' % cg.extras['clcount'],
1591 outgoing.missingheads): 1591 mandatory=False)
1592 part.addparam('targetphase', '%d' % phases.secret, mandatory=False) 1592 if opts.get('phases') and repo.revs('%ln and secret()',
1593 outgoing.missingheads):
1594 part.addparam('targetphase', '%d' % phases.secret, mandatory=False)
1593 1595
1594 addparttagsfnodescache(repo, bundler, outgoing) 1596 addparttagsfnodescache(repo, bundler, outgoing)
1595 addpartrevbranchcache(repo, bundler, outgoing) 1597 addpartrevbranchcache(repo, bundler, outgoing)
1596 1598
1597 if opts.get('obsolescence', False): 1599 if opts.get('obsolescence', False):