diff 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
line wrap: on
line diff
--- a/mercurial/debugcommands.py	Fri Jun 16 16:56:16 2017 -0700
+++ b/mercurial/debugcommands.py	Thu Jun 22 10:10:02 2017 -0700
@@ -311,6 +311,15 @@
             cmdutil.showmarker(fm, m)
         fm.end()
 
+def _debugphaseheads(ui, data, indent=0):
+    """display version and markers contained in 'data'"""
+    indent_string = ' ' * indent
+    headsbyphase = bundle2._readphaseheads(data)
+    for phase in phases.allphases:
+        for head in headsbyphase[phase]:
+            ui.write(indent_string)
+            ui.write('%s %s\n' % (hex(head), phases.phasenames[phase]))
+
 def _debugbundle2(ui, gen, all=None, **opts):
     """lists the contents of a bundle2"""
     if not isinstance(gen, bundle2.unbundle20):
@@ -327,6 +336,8 @@
             _debugchangegroup(ui, cg, all=all, indent=4, **opts)
         if part.type == 'obsmarkers':
             _debugobsmarkers(ui, part, indent=4, **opts)
+        if part.type == 'phase-heads':
+            _debugphaseheads(ui, part, indent=4)
 
 @command('debugbundle',
         [('a', 'all', None, _('show all details')),