Mercurial > public > mercurial-scm > hg
comparison mercurial/bundle2.py @ 34101:5ede882c249c
changegroup: replace getchangegroup with makechangegroup
As part of reducing the number of changegroup creation APIs, let's replace
getchangegroup with calls to makechangegroup. This is mostly a drop in
replacement, but it does change the version specifier to be required, so it's
more obvious which callers are creating old version 1 changegroups still.
Differential Revision: https://phab.mercurial-scm.org/D669
author | Durham Goode <durham@fb.com> |
---|---|
date | Sun, 10 Sep 2017 18:50:12 -0700 |
parents | 891118dcd279 |
children | e9e0e1143fc5 |
comparison
equal
deleted
inserted
replaced
34100:1632999d4bed | 34101:5ede882c249c |
---|---|
1391 return [int(c[1:]) for c in obscaps if c.startswith('V')] | 1391 return [int(c[1:]) for c in obscaps if c.startswith('V')] |
1392 | 1392 |
1393 def writenewbundle(ui, repo, source, filename, bundletype, outgoing, opts, | 1393 def writenewbundle(ui, repo, source, filename, bundletype, outgoing, opts, |
1394 vfs=None, compression=None, compopts=None): | 1394 vfs=None, compression=None, compopts=None): |
1395 if bundletype.startswith('HG10'): | 1395 if bundletype.startswith('HG10'): |
1396 cg = changegroup.getchangegroup(repo, source, outgoing, version='01') | 1396 cg = changegroup.makechangegroup(repo, outgoing, '01', source) |
1397 return writebundle(ui, cg, filename, bundletype, vfs=vfs, | 1397 return writebundle(ui, cg, filename, bundletype, vfs=vfs, |
1398 compression=compression, compopts=compopts) | 1398 compression=compression, compopts=compopts) |
1399 elif not bundletype.startswith('HG20'): | 1399 elif not bundletype.startswith('HG20'): |
1400 raise error.ProgrammingError('unknown bundle type: %s' % bundletype) | 1400 raise error.ProgrammingError('unknown bundle type: %s' % bundletype) |
1401 | 1401 |
1419 | 1419 |
1420 # we always want a changegroup in such bundle | 1420 # we always want a changegroup in such bundle |
1421 cgversion = opts.get('cg.version') | 1421 cgversion = opts.get('cg.version') |
1422 if cgversion is None: | 1422 if cgversion is None: |
1423 cgversion = changegroup.safeversion(repo) | 1423 cgversion = changegroup.safeversion(repo) |
1424 cg = changegroup.getchangegroup(repo, source, outgoing, | 1424 cg = changegroup.makechangegroup(repo, outgoing, cgversion, source) |
1425 version=cgversion) | |
1426 part = bundler.newpart('changegroup', data=cg.getchunks()) | 1425 part = bundler.newpart('changegroup', data=cg.getchunks()) |
1427 part.addparam('version', cg.version) | 1426 part.addparam('version', cg.version) |
1428 if 'clcount' in cg.extras: | 1427 if 'clcount' in cg.extras: |
1429 part.addparam('nbchanges', str(cg.extras['clcount']), | 1428 part.addparam('nbchanges', str(cg.extras['clcount']), |
1430 mandatory=False) | 1429 mandatory=False) |