Gregory Szorc <gregory.szorc@gmail.com> [Sun, 11 Mar 2018 10:38:46 -0700] rev 36900
hgweb: remove unused **map argument
It was unused before the recent code refactoring AFAICT.
Differential Revision: https://phab.mercurial-scm.org/D2816
Gregory Szorc <gregory.szorc@gmail.com> [Sun, 11 Mar 2018 10:37:25 -0700] rev 36899
hgweb: extract entries() to standalone function
There was some real wonkiness going on here. Essentially, the
inline function was being executed with default arguments because
a function reference was passed as-is into the templater. That
seemed odd. So now we pass an explicit generator of the function
result.
Moving this code out of makeindex() makes makeindex() small enough
to reason about. This makes it easier to see weird things, like the
fact that we're calling self.refresh() twice. Why, I'm not sure.
I'm also not sure why we need to call updatereqenv() to possibly
update the SERVER_NAME, SERVER_PORT, and SCRIPT_NAME variables as
part of rendering an index. I'll dig into these things in subsequent
commits.
Differential Revision: https://phab.mercurial-scm.org/D2815
Gregory Szorc <gregory.szorc@gmail.com> [Sun, 11 Mar 2018 10:24:46 -0700] rev 36898
hgweb: move rawentries() to a standalone function
It was only accessing a few variables from the outer scope. Let's
make it standalone so there is better clarity about what the inputs
are.
Differential Revision: https://phab.mercurial-scm.org/D2814
Gregory Szorc <gregory.szorc@gmail.com> [Sun, 11 Mar 2018 10:17:58 -0700] rev 36897
hgweb: move archivelist to standalone function
This doesn't need to exist as an inline function in a method.
Minor formatting changes were made as part of the move.
Differential Revision: https://phab.mercurial-scm.org/D2813
Gregory Szorc <gregory.szorc@gmail.com> [Sun, 11 Mar 2018 10:15:33 -0700] rev 36896
hgweb: move readallowed to a standalone function
hgwebdir s kind of large. Let's make the class smaller by
moving things that don't need to be there.
Differential Revision: https://phab.mercurial-scm.org/D2812
Gregory Szorc <gregory.szorc@gmail.com> [Sun, 11 Mar 2018 15:51:13 -0700] rev 36895
hgweb: remove some use of wsgireq in hgwebdir
While we're here, rename a method so abide by our style policy,
since otherwise check-commit would complain.
Differential Revision: https://phab.mercurial-scm.org/D2805
Gregory Szorc <gregory.szorc@gmail.com> [Sat, 10 Mar 2018 20:54:44 -0800] rev 36894
hgweb: fix a bug due to variable name typo
It looks like the "sort" query string parameter was not being
honored properly.
Differential Revision: https://phab.mercurial-scm.org/D2804
Gregory Szorc <gregory.szorc@gmail.com> [Sat, 10 Mar 2018 20:51:46 -0800] rev 36893
hgweb: stop passing req and tmpl into @webcommand functions (API)
We have effectively removed all consumers of the old wsgirequest
type. The templater can be accessed on the requestcontext passed
into the @webcommand function.
For the most part, these arguments are unused. They only exist to
provide backwards compatibility. And in the case of wsgirequest,
use of that object could actively interfere with the new request
object.
So let's stop passing these objects to @webcommand functions.
With this commit, wsgirequest is practically dead from the hgweb
WSGI application. There are still some uses in hgwebdir though...
.. api::
@webcommand functions now only receive a single argument. The
request and templater instances can be accessed via the
``req`` and ``templater`` attributes of the first argument.
Note that the request object is different from previous Mercurial
releases and consumers of the previous ``req`` 2nd argument
will need updating to use the new API.
Differential Revision: https://phab.mercurial-scm.org/D2803
Gregory Szorc <gregory.szorc@gmail.com> [Sat, 10 Mar 2018 19:57:08 -0800] rev 36892
hgweb: pass modern request type into various webutil functions (API)
Our march towards killing wsgirequest continues.
.. api::
Various functions in hgweb.webutil now take a modern request
object instead of ``wsgirequest``.
Differential Revision: https://phab.mercurial-scm.org/D2802
Gregory Szorc <gregory.szorc@gmail.com> [Sat, 10 Mar 2018 19:46:54 -0800] rev 36891
hgweb: don't redundantly pass templater with requestcontext (API)
The requestcontenxt has a ``tmpl`` attribute to access the
templater. We don't need to pass the templater explicitly when
passing a requestcontext instance.
.. api::
Various helper functions in hgweb.webutil no longer accept a
templater instance. Access the templater through the
``web`` argument instead.
Differential Revision: https://phab.mercurial-scm.org/D2801