D6326: gendoc: group commands by category in man page and HTML help
Sietse (Sietse Brouwer)
phabricator at mercurial-scm.org
Fri May 3 09:48:56 EDT 2019
Sietse marked 3 inline comments as done.
Sietse added inline comments.
> martinvonz wrote in gendoc.py:188
> Looks like just want `h` and `cmdtable` from the outer scope. They are available without this trick, so you can just delete the two arguments here.
Passing `h=h, cmdtable=cmdtable` as default args is to make it obvious to the reader which data the function depends on. I realize it can also silently close over the variables in the outer scope, but I think this helps legibility.
Other places in the Mercurial codebase that define an inner function, and make a captured value obvious by passing it as a default argument:
- `def commithook` inside `def commit` in `localrepo.py`
- `def one` inside `def _showcompatlist` in `templateutil.py` (edge case, as the default arg is actually overridden once)
- `def doit` inside `def debugdiscovery` in `debugcommands.py
I'd say leave this as is, but I'll let you make the call and follow that.
To: Sietse, #hg-reviewers, martinvonz
Cc: martinvonz, mercurial-devel
More information about the Mercurial-devel