comparison mercurial/debugcommands.py @ 33029:b482d80e041b

debugcommands: pass part, not read data, into _debugobsmarker() This matches how it's done for _debugchangegroup() and how we will soon do it for _debugphaseheads().
author Martin von Zweigbergk <martinvonz@google.com>
date Thu, 22 Jun 2017 10:15:15 -0700
parents bdf4227614e2
children e8c8d81eb864
comparison
equal deleted inserted replaced
33028:bdf4227614e2 33029:b482d80e041b
287 for chunkdata in iter(lambda: gen.deltachunk(chain), {}): 287 for chunkdata in iter(lambda: gen.deltachunk(chain), {}):
288 node = chunkdata['node'] 288 node = chunkdata['node']
289 ui.write("%s%s\n" % (indent_string, hex(node))) 289 ui.write("%s%s\n" % (indent_string, hex(node)))
290 chain = node 290 chain = node
291 291
292 def _debugobsmarkers(ui, data, indent=0, **opts): 292 def _debugobsmarkers(ui, part, indent=0, **opts):
293 """display version and markers contained in 'data'""" 293 """display version and markers contained in 'data'"""
294 data = part.read()
294 indent_string = ' ' * indent 295 indent_string = ' ' * indent
295 try: 296 try:
296 version, markers = obsolete._readmarkers(data) 297 version, markers = obsolete._readmarkers(data)
297 except error.UnknownVersion as exc: 298 except error.UnknownVersion as exc:
298 msg = "%sunsupported version: %s (%d bytes)\n" 299 msg = "%sunsupported version: %s (%d bytes)\n"
323 if part.type == 'changegroup': 324 if part.type == 'changegroup':
324 version = part.params.get('version', '01') 325 version = part.params.get('version', '01')
325 cg = changegroup.getunbundler(version, part, 'UN') 326 cg = changegroup.getunbundler(version, part, 'UN')
326 _debugchangegroup(ui, cg, all=all, indent=4, **opts) 327 _debugchangegroup(ui, cg, all=all, indent=4, **opts)
327 if part.type == 'obsmarkers': 328 if part.type == 'obsmarkers':
328 _debugobsmarkers(ui, part.read(), indent=4, **opts) 329 _debugobsmarkers(ui, part, indent=4, **opts)
329 330
330 @command('debugbundle', 331 @command('debugbundle',
331 [('a', 'all', None, _('show all details')), 332 [('a', 'all', None, _('show all details')),
332 ('', 'part-type', [], _('show only the named part type')), 333 ('', 'part-type', [], _('show only the named part type')),
333 ('', 'spec', None, _('print the bundlespec of the bundle'))], 334 ('', 'spec', None, _('print the bundlespec of the bundle'))],