D6327: gendoc: guarantee that all commands were processed.
Sietse (Sietse Brouwer)
phabricator at mercurial-scm.org
Fri May 3 13:36:54 UTC 2019
Sietse updated this revision to Diff 14990.
Sietse retitled this revision from "gendoc: guarantee that all commands were processed" to "gendoc: guarantee that all commands were processed.".
REPOSITORY
rHG Mercurial
CHANGES SINCE LAST UPDATE
https://phab.mercurial-scm.org/D6327?vs=14960&id=14990
REVISION DETAIL
https://phab.mercurial-scm.org/D6327
AFFECTED FILES
doc/gendoc.py
CHANGE DETAILS
diff --git a/doc/gendoc.py b/doc/gendoc.py
--- a/doc/gendoc.py
+++ b/doc/gendoc.py
@@ -194,13 +194,21 @@
helpcategory = details[0].helpcategory
return helpcategory or help.registrar.command.CATEGORY_NONE
+ cmdsbycategory = {category: [] for category in help.CATEGORY_ORDER}
+ for cmd in cmds:
+ try:
+ cmdsbycategory[helpcategory(cmd)].append(cmd)
+ except KeyError:
+ # If a command category wasn't registered, the command won't get
+ # rendered below, so we raise an AssertionError.
+ raise AssertionError(
+ "The following command did not register its (category) in "
+ "help.CATEGORY_ORDER: %s (%s)" % (cmd, helpcategory(cmd))
+ )
+
# 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.
- cmdsbycategory = {category: [] for category in help.CATEGORY_ORDER}
- for cmd in cmds:
- cmdsbycategory[helpcategory(cmd)].append(cmd)
-
for category in help.CATEGORY_ORDER:
categorycmds = cmdsbycategory[category]
if not categorycmds:
@@ -249,7 +257,6 @@
if d[b'aliases']:
ui.write(_(b" aliases: %s\n\n") % b" ".join(d[b'aliases']))
-
def allextensionnames():
return set(extensions.enabled().keys()) | set(extensions.disabled().keys())
To: Sietse, #hg-reviewers, martinvonz
Cc: martinvonz, mercurial-devel
More information about the Mercurial-devel
mailing list