##// END OF EJS Templates
help: reorder section filtering flow to not format help text twice
Yuya Nishihara -
r39345:0a766cb1 default
parent child Browse files
Show More
@@ -673,16 +673,6 b' def formattedhelp(ui, commands, name, ke'
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:
@@ -690,4 +680,11 b' def formattedhelp(ui, commands, name, ke'
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)
General Comments 0
You need to be logged in to leave comments. Login now