comparison mercurial/debugcommands.py @ 33043:e8c8d81eb864

bundle: add config option to include phases This adds an experimental.bundle-phases config option to include phase information in bundles. As with the recently added support for bundling obsmarkers, the support for bundling phases is hidden behind the config option until we decide to make a bundlespec v3 that includes phases (and obsmarkers and ...). We could perhaps use the listkeys format for this, but that's considered obsolete according to Pierre-Yves. Instead, we introduce a new "phase-heads" bundle part. The new part contains the phase heads among the set of bundled revisions. It does not include those in secret phase; any head in the bundle that is not mentioned in the phase-heads part is assumed to be secret. As a special case, an empty phase-heads part thus means that any changesets should be added in secret phase. (If we ever add a fourth phase, we'll include secret in the part and we'll add a version number.) For now, phases are only included by "hg bundle", and not by e.g. strip and rebase.
author Martin von Zweigbergk <martinvonz@google.com>
date Thu, 22 Jun 2017 10:10:02 -0700
parents b482d80e041b
children 03eefca3ed33
comparison
equal deleted inserted replaced
33042:3e102a8dd52c 33043:e8c8d81eb864
309 fm.startitem() 309 fm.startitem()
310 fm.plain(indent_string) 310 fm.plain(indent_string)
311 cmdutil.showmarker(fm, m) 311 cmdutil.showmarker(fm, m)
312 fm.end() 312 fm.end()
313 313
314 def _debugphaseheads(ui, data, indent=0):
315 """display version and markers contained in 'data'"""
316 indent_string = ' ' * indent
317 headsbyphase = bundle2._readphaseheads(data)
318 for phase in phases.allphases:
319 for head in headsbyphase[phase]:
320 ui.write(indent_string)
321 ui.write('%s %s\n' % (hex(head), phases.phasenames[phase]))
322
314 def _debugbundle2(ui, gen, all=None, **opts): 323 def _debugbundle2(ui, gen, all=None, **opts):
315 """lists the contents of a bundle2""" 324 """lists the contents of a bundle2"""
316 if not isinstance(gen, bundle2.unbundle20): 325 if not isinstance(gen, bundle2.unbundle20):
317 raise error.Abort(_('not a bundle2 file')) 326 raise error.Abort(_('not a bundle2 file'))
318 ui.write(('Stream params: %s\n' % repr(gen.params))) 327 ui.write(('Stream params: %s\n' % repr(gen.params)))
325 version = part.params.get('version', '01') 334 version = part.params.get('version', '01')
326 cg = changegroup.getunbundler(version, part, 'UN') 335 cg = changegroup.getunbundler(version, part, 'UN')
327 _debugchangegroup(ui, cg, all=all, indent=4, **opts) 336 _debugchangegroup(ui, cg, all=all, indent=4, **opts)
328 if part.type == 'obsmarkers': 337 if part.type == 'obsmarkers':
329 _debugobsmarkers(ui, part, indent=4, **opts) 338 _debugobsmarkers(ui, part, indent=4, **opts)
339 if part.type == 'phase-heads':
340 _debugphaseheads(ui, part, indent=4)
330 341
331 @command('debugbundle', 342 @command('debugbundle',
332 [('a', 'all', None, _('show all details')), 343 [('a', 'all', None, _('show all details')),
333 ('', 'part-type', [], _('show only the named part type')), 344 ('', 'part-type', [], _('show only the named part type')),
334 ('', 'spec', None, _('print the bundlespec of the bundle'))], 345 ('', 'spec', None, _('print the bundlespec of the bundle'))],