hgext3rd/evolve/obshistory.py
changeset 5300 372dc6c5692a
parent 5216 8c131b97e197
child 5301 35c15057e2e5
equal deleted inserted replaced
5299:426f2800b793 5300:372dc6c5692a
   167             changenode = ctx.node()
   167             changenode = ctx.node()
   168 
   168 
   169             _props = {b"template": self.template}
   169             _props = {b"template": self.template}
   170             fm = self.ui.formatter(b'debugobshistory', _props)
   170             fm = self.ui.formatter(b'debugobshistory', _props)
   171 
   171 
   172             _debugobshistorydisplaynode(fm, self.repo, changenode)
   172             displaynode(fm, self.repo, changenode)
   173 
   173 
   174             markerfm = fm.nested(b"markers")
   174             markerfm = fm.nested(b"markers")
   175 
   175 
   176             # Succs markers
   176             # Succs markers
   177             if self.filter is False:
   177             if self.filter is False:
   450     seen = set(nodes)
   450     seen = set(nodes)
   451 
   451 
   452     while nodes:
   452     while nodes:
   453         ctxnode = nodes.pop()
   453         ctxnode = nodes.pop()
   454 
   454 
   455         _debugobshistorydisplaynode(fm, unfi, ctxnode)
   455         displaynode(fm, unfi, ctxnode)
   456 
   456 
   457         succs = successors.get(ctxnode, ())
   457         succs = successors.get(ctxnode, ())
   458 
   458 
   459         markerfm = fm.nested(b"markers")
   459         markerfm = fm.nested(b"markers")
   460         for successor in sorted(succs):
   460         for successor in sorted(succs):
   469             if p[0] not in seen:
   469             if p[0] not in seen:
   470                 seen.add(p[0])
   470                 seen.add(p[0])
   471                 nodes.append(p[0])
   471                 nodes.append(p[0])
   472     fm.end()
   472     fm.end()
   473 
   473 
   474 def _debugobshistorydisplaynode(fm, repo, node):
   474 def displaynode(fm, repo, node):
   475     if node in repo:
   475     if node in repo:
   476         _debugobshistorydisplayctx(fm, repo[node])
   476         displayctx(fm, repo[node])
   477     else:
   477     else:
   478         _debugobshistorydisplaymissingctx(fm, node)
   478         displaymissingctx(fm, node)
   479 
   479 
   480 def _debugobshistorydisplayctx(fm, ctx):
   480 def displayctx(fm, ctx):
   481     shortdescription = ctx.description().strip()
   481     shortdescription = ctx.description().strip()
   482     if shortdescription:
   482     if shortdescription:
   483         shortdescription = shortdescription.splitlines()[0]
   483         shortdescription = shortdescription.splitlines()[0]
   484 
   484 
   485     fm.startitem()
   485     fm.startitem()
   493 
   493 
   494     fm.write(b'shortdescription', b'%s', shortdescription,
   494     fm.write(b'shortdescription', b'%s', shortdescription,
   495              label=b"evolve.short_description")
   495              label=b"evolve.short_description")
   496     fm.plain(b'\n')
   496     fm.plain(b'\n')
   497 
   497 
   498 def _debugobshistorydisplaymissingctx(fm, nodewithoutctx):
   498 def displaymissingctx(fm, nodewithoutctx):
   499     fm.startitem()
   499     fm.startitem()
   500     fm.data(node=nodemod.hex(nodewithoutctx))
   500     fm.data(node=nodemod.hex(nodewithoutctx))
   501     fm.plain(nodemod.short(nodewithoutctx),
   501     fm.plain(nodemod.short(nodewithoutctx),
   502              label=b"evolve.node evolve.missing_change_ctx")
   502              label=b"evolve.node evolve.missing_change_ctx")
   503     fm.plain(b'\n')
   503     fm.plain(b'\n')