D6327: gendoc: guarantee that all commands were processed
martinvonz (Martin von Zweigbergk)
phabricator at mercurial-scm.org
Fri May 3 12:06:51 EDT 2019
martinvonz added inline comments.
INLINE COMMENTS
> gendoc.py:198-207
> + 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(
No need to use exceptions here (`KeyError` could potentially be raised by something we didn't expect and then we'd misdiagnose it here). I think it's clearer like this:
category = helpcategory(cmd)
if category in cmdsbycategory:
raise ...
cmdsbycategory[category].append(cmd)
> gendoc.py:200
> + try:
> + cmdsbycategory[helpcategory(cmd)].append(cmd)
> + except KeyError:
I think a previous version of this patch ignored uncategorized debug commands. Will this version error out?
REPOSITORY
rHG Mercurial
REVISION DETAIL
https://phab.mercurial-scm.org/D6327
To: Sietse, #hg-reviewers, martinvonz
Cc: martinvonz, mercurial-devel
More information about the Mercurial-devel
mailing list