This commit fixes the @webcommand decorator used to define
webcommands. Although webcommands are currently using this
decorator, it does not behave as intended. Using the decorator
should record the name of the decorator in a commands dict,
and when a request arrives to hgweb the correct function to
call should be resolved from that dict.
In the current implementation the command is added to the
commands dict, but when hgweb attempts to resolve the function
while processing a request, it instead looks for an attribute
with the same name attached to the webcommands module. To
summarize, a command 'commandname' should be resolved from
`mercurial.hgweb.webcommands.commands['commandname']`
but is instead being resolved from
`mercurial.hgweb.webcommands.commandname`
The decorator appears to be working on the core webcommands
(such as log, rev, file) however this is because those
commands are defined with the same name in the underlying
Python function.
This commit changes hgweb_mod.py to resolve the function used
from webcommands to come from the commands dict in the
webcommands module. Due to the change in how webcommands
are resolved, a wrapwebcommand function is also added, which
wraps a webcommand by applying the wrapper as a partial function
and overwrites the existing function in the commands dict.
Wrapped webcommands in shipped extensions and hgweb tests
are changed to use the fixed decorator and wrapwebcommand
function.