mercurial/help.py
changeset 39309 0a766cb1092a
parent 39308 9b800601701c
child 39339 d30867a745a1
equal deleted inserted replaced
39308:9b800601701c 39309:0a766cb1092a
   671         textwidth = termwidth
   671         textwidth = termwidth
   672     text = help_(ui, commands, name,
   672     text = help_(ui, commands, name,
   673                  subtopic=subtopic, unknowncmd=unknowncmd, full=full, **opts)
   673                  subtopic=subtopic, unknowncmd=unknowncmd, full=full, **opts)
   674 
   674 
   675     blocks, pruned = minirst.parse(text, keep=keep)
   675     blocks, pruned = minirst.parse(text, keep=keep)
   676     if section:
       
   677         blocks = minirst.filtersections(blocks, section)
       
   678     formatted = minirst.formatplain(blocks, textwidth)
       
   679 
       
   680     # We could have been given a weird ".foo" section without a name
       
   681     # to look for, or we could have simply failed to found "foo.bar"
       
   682     # because bar isn't a section of foo
       
   683     if section and not (formatted and name):
       
   684         raise error.Abort(_("help section not found: %s") % fullname)
       
   685 
       
   686     if 'verbose' in pruned:
   676     if 'verbose' in pruned:
   687         keep.append('omitted')
   677         keep.append('omitted')
   688     else:
   678     else:
   689         keep.append('notomitted')
   679         keep.append('notomitted')
   690     blocks, pruned = minirst.parse(text, keep=keep)
   680     blocks, pruned = minirst.parse(text, keep=keep)
   691     if section:
   681     if section:
   692         blocks = minirst.filtersections(blocks, section)
   682         blocks = minirst.filtersections(blocks, section)
       
   683 
       
   684     # We could have been given a weird ".foo" section without a name
       
   685     # to look for, or we could have simply failed to found "foo.bar"
       
   686     # because bar isn't a section of foo
       
   687     if section and not (blocks and name):
       
   688         raise error.Abort(_("help section not found: %s") % fullname)
       
   689 
   693     return minirst.formatplain(blocks, textwidth)
   690     return minirst.formatplain(blocks, textwidth)