diff --git a/doc/gendoc.py b/doc/gendoc.py --- a/doc/gendoc.py +++ b/doc/gendoc.py @@ -196,6 +196,12 @@ return help.registrar.command.CATEGORY_NONE return helpcategory + # Keep a log of processed commands. If a command category isn't registered + # in help.CATEGORY_ORDER, the command doesn't get processed by + # commandprinter. By comparing the list of processed commands to the + # original list of commands, we can detect unregistered categories. + processedcmds = [] + # Print the help for each command. We present the commands grouped by # category, and we use help.CATEGORY_ORDER as a guide for a helpful order # in which to present the categories. @@ -216,6 +222,7 @@ for f in sorted(categorycmds): if f.startswith(b"debug"): continue + processedcmds.append(f) # log command d = get_cmd(h[f], cmdtable) ui.write(sectionfunc(d[b'cmd'])) # short description @@ -251,7 +258,17 @@ # aliases if d[b'aliases']: ui.write(_(b" aliases: %s\n\n") % b" ".join(d[b'aliases'])) - + # Make sure that we left no commands unprocessed. + expected = sorted(filter(lambda c: not c.startswith('debug'), cmds)) + observed = sorted(processedcmds) + if not observed == expected: + unprocessed = sorted(set(expected) - set(observed)) + unprocessedinfo = ', '.join( + "%s (%s)" % (cmd, helpcategory(cmd)) + for cmd in unprocessed + ) + raise AssertionError("The following commands did not register their" + " (category) in help.CATEGORY_ORDER: %s" % unprocessedinfo) def allextensionnames(): return set(extensions.enabled().keys()) | set(extensions.disabled().keys())