debugbundle: display the content of obsmarkers parts
We parse and display the markers in the part when possible.
--- a/mercurial/debugcommands.py Sun May 28 11:50:43 2017 -0700
+++ b/mercurial/debugcommands.py Thu May 25 16:50:46 2017 +0200
@@ -288,6 +288,27 @@
ui.write("%s%s\n" % (indent_string, hex(node)))
chain = node
+def _debugobsmarkers(ui, data, all=None, indent=0, **opts):
+ """display version and markers contained in 'data'"""
+ indent_string = ' ' * indent
+ try:
+ version, markers = obsolete._readmarkers(data)
+ except error.UnknownVersion as exc:
+ msg = "%sunsupported version: %s (%d bytes)\n"
+ msg %= indent_string, exc.version, len(data)
+ ui.write(msg)
+ else:
+ msg = "%sversion: %s (%d bytes)\n"
+ msg %= indent_string, version, len(data)
+ ui.write(msg)
+ fm = ui.formatter('debugobsolete', opts)
+ for rawmarker in sorted(markers):
+ m = obsolete.marker(None, rawmarker)
+ fm.startitem()
+ fm.plain(indent_string)
+ cmdutil.showmarker(fm, m)
+ fm.end()
+
def _debugbundle2(ui, gen, all=None, **opts):
"""lists the contents of a bundle2"""
if not isinstance(gen, bundle2.unbundle20):
@@ -299,6 +320,8 @@
version = part.params.get('version', '01')
cg = changegroup.getunbundler(version, part, 'UN')
_debugchangegroup(ui, cg, all=all, indent=4, **opts)
+ if part.type == 'obsmarkers':
+ _debugobsmarkers(ui, part.read(), all=all, indent=4, **opts)
@command('debugbundle',
[('a', 'all', None, _('show all details')),
--- a/tests/test-obsolete-changeset-exchange.t Sun May 28 11:50:43 2017 -0700
+++ b/tests/test-obsolete-changeset-exchange.t Thu May 25 16:50:46 2017 +0200
@@ -97,6 +97,8 @@
changegroup -- "sortdict([('version', '02'), ('nbchanges', '1')])"
f89bcc95eba5174b1ccc3e33a82e84c96e8338ee
obsmarkers -- 'sortdict()'
+ version: 1 (70 bytes)
+ 9d73aac1b2ed7d53835eaeec212ed41ea47da53a f89bcc95eba5174b1ccc3e33a82e84c96e8338ee 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
$ cd ..