Mercurial > public > mercurial-scm > hg
comparison mercurial/debugcommands.py @ 32517:b62b2b373bce
debugbundle: display the content of obsmarkers parts
We parse and display the markers in the part when possible.
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Thu, 25 May 2017 16:50:46 +0200 |
parents | 2def402bd16d |
children | 00a7f7b1af9c |
comparison
equal
deleted
inserted
replaced
32516:37d70ba1d9d1 | 32517:b62b2b373bce |
---|---|
286 for chunkdata in iter(lambda: gen.deltachunk(chain), {}): | 286 for chunkdata in iter(lambda: gen.deltachunk(chain), {}): |
287 node = chunkdata['node'] | 287 node = chunkdata['node'] |
288 ui.write("%s%s\n" % (indent_string, hex(node))) | 288 ui.write("%s%s\n" % (indent_string, hex(node))) |
289 chain = node | 289 chain = node |
290 | 290 |
291 def _debugobsmarkers(ui, data, all=None, indent=0, **opts): | |
292 """display version and markers contained in 'data'""" | |
293 indent_string = ' ' * indent | |
294 try: | |
295 version, markers = obsolete._readmarkers(data) | |
296 except error.UnknownVersion as exc: | |
297 msg = "%sunsupported version: %s (%d bytes)\n" | |
298 msg %= indent_string, exc.version, len(data) | |
299 ui.write(msg) | |
300 else: | |
301 msg = "%sversion: %s (%d bytes)\n" | |
302 msg %= indent_string, version, len(data) | |
303 ui.write(msg) | |
304 fm = ui.formatter('debugobsolete', opts) | |
305 for rawmarker in sorted(markers): | |
306 m = obsolete.marker(None, rawmarker) | |
307 fm.startitem() | |
308 fm.plain(indent_string) | |
309 cmdutil.showmarker(fm, m) | |
310 fm.end() | |
311 | |
291 def _debugbundle2(ui, gen, all=None, **opts): | 312 def _debugbundle2(ui, gen, all=None, **opts): |
292 """lists the contents of a bundle2""" | 313 """lists the contents of a bundle2""" |
293 if not isinstance(gen, bundle2.unbundle20): | 314 if not isinstance(gen, bundle2.unbundle20): |
294 raise error.Abort(_('not a bundle2 file')) | 315 raise error.Abort(_('not a bundle2 file')) |
295 ui.write(('Stream params: %s\n' % repr(gen.params))) | 316 ui.write(('Stream params: %s\n' % repr(gen.params))) |
297 ui.write('%s -- %r\n' % (part.type, repr(part.params))) | 318 ui.write('%s -- %r\n' % (part.type, repr(part.params))) |
298 if part.type == 'changegroup': | 319 if part.type == 'changegroup': |
299 version = part.params.get('version', '01') | 320 version = part.params.get('version', '01') |
300 cg = changegroup.getunbundler(version, part, 'UN') | 321 cg = changegroup.getunbundler(version, part, 'UN') |
301 _debugchangegroup(ui, cg, all=all, indent=4, **opts) | 322 _debugchangegroup(ui, cg, all=all, indent=4, **opts) |
323 if part.type == 'obsmarkers': | |
324 _debugobsmarkers(ui, part.read(), all=all, indent=4, **opts) | |
302 | 325 |
303 @command('debugbundle', | 326 @command('debugbundle', |
304 [('a', 'all', None, _('show all details')), | 327 [('a', 'all', None, _('show all details')), |
305 ('', 'spec', None, _('print the bundlespec of the bundle'))], | 328 ('', 'spec', None, _('print the bundlespec of the bundle'))], |
306 _('FILE'), | 329 _('FILE'), |