Mercurial > hg
comparison mercurial/bundle2.py @ 32516:37d70ba1d9d1
bundle: add an experimental knob to include obsmarkers in bundle
The "hg bundle" command is a good place to test if the inclusion of obsmarkers
within a bundle is working well (part exists, content is correct etc). So we
add a way to have them included.
Ideally, this would be controlled by a change around bundlespec (bundlespec
"v3" + arguments). However, my main goal is to have obsmarkers included in
bundle created by the 'hg strip' command, not the 'hg bundle' so for now I'm
avoiding the detour through bundlespec rework territory.
Better debug output for obsmarkers in 'debugbundle' will be added in later
changesets. The 'test-obsolete-bundle-strip.t' test will also get updated in a
later changeset to keep the current changeset smaller.
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Sun, 28 May 2017 11:50:43 -0700 |
parents | e70d6dbde713 |
children | 16ada4cbb1a9 |
comparison
equal
deleted
inserted
replaced
32515:e70d6dbde713 | 32516:37d70ba1d9d1 |
---|---|
1346 return writebundle(ui, cg, filename, bundletype, vfs=vfs, | 1346 return writebundle(ui, cg, filename, bundletype, vfs=vfs, |
1347 compression=compression, compopts=compopts) | 1347 compression=compression, compopts=compopts) |
1348 elif not bundletype.startswith('HG20'): | 1348 elif not bundletype.startswith('HG20'): |
1349 raise error.ProgrammingError('unknown bundle type: %s' % bundletype) | 1349 raise error.ProgrammingError('unknown bundle type: %s' % bundletype) |
1350 | 1350 |
1351 bundle = bundle20(ui) | 1351 caps = {} |
1352 if 'obsolescence' in opts: | |
1353 caps['obsmarkers'] = ('V1',) | |
1354 bundle = bundle20(ui, caps) | |
1352 bundle.setcompression(compression, compopts) | 1355 bundle.setcompression(compression, compopts) |
1353 _addpartsfromopts(ui, repo, bundle, source, outgoing, opts) | 1356 _addpartsfromopts(ui, repo, bundle, source, outgoing, opts) |
1354 chunkiter = bundle.getchunks() | 1357 chunkiter = bundle.getchunks() |
1355 | 1358 |
1356 return changegroup.writechunks(ui, chunkiter, filename, vfs=vfs) | 1359 return changegroup.writechunks(ui, chunkiter, filename, vfs=vfs) |
1374 if 'clcount' in cg.extras: | 1377 if 'clcount' in cg.extras: |
1375 part.addparam('nbchanges', str(cg.extras['clcount']), | 1378 part.addparam('nbchanges', str(cg.extras['clcount']), |
1376 mandatory=False) | 1379 mandatory=False) |
1377 | 1380 |
1378 addparttagsfnodescache(repo, bundler, outgoing) | 1381 addparttagsfnodescache(repo, bundler, outgoing) |
1382 | |
1383 if opts.get('obsolescence', False): | |
1384 obsmarkers = repo.obsstore.relevantmarkers(outgoing.missing) | |
1385 buildobsmarkerspart(bundler, obsmarkers) | |
1379 | 1386 |
1380 def addparttagsfnodescache(repo, bundler, outgoing): | 1387 def addparttagsfnodescache(repo, bundler, outgoing): |
1381 # we include the tags fnode cache for the bundle changeset | 1388 # we include the tags fnode cache for the bundle changeset |
1382 # (as an optional parts) | 1389 # (as an optional parts) |
1383 cache = tags.hgtagsfnodescache(repo.unfiltered()) | 1390 cache = tags.hgtagsfnodescache(repo.unfiltered()) |