hgweb: avoid invalid infinity scroll request when overwritten web.style
Infinity scroll is broken when you override the web.style in the following ways:
$ hg --config='web.style=gitweb' serve
$ open http://localhost:8080/shortlog?style=paper
ajaxScrollInit should use http://localhost:8080/shortlog/%next%?style=paper.
however, http://localhost:8080/shortlog/%next% is used actually.
It is missing style parameter.
This patch add style parameter to request url.
--- a/mercurial/hgweb/hgweb_mod.py Wed Jan 08 00:26:55 2014 +0900
+++ b/mercurial/hgweb/hgweb_mod.py Wed Jan 08 00:35:03 2014 +0900
@@ -373,6 +373,7 @@
"motd": motd,
"sessionvars": sessionvars,
"pathdef": makebreadcrumb(req.url),
+ "style": style,
})
return tmpl
--- a/mercurial/hgweb/hgwebdir_mod.py Wed Jan 08 00:26:55 2014 +0900
+++ b/mercurial/hgweb/hgwebdir_mod.py Wed Jan 08 00:35:03 2014 +0900
@@ -448,7 +448,9 @@
"logourl": logourl,
"logoimg": logoimg,
"staticurl": staticurl,
- "sessionvars": sessionvars})
+ "sessionvars": sessionvars,
+ "style": style,
+ })
return tmpl
def updatereqenv(self, env):
--- a/mercurial/templates/paper/graph.tmpl Wed Jan 08 00:26:55 2014 +0900
+++ b/mercurial/templates/paper/graph.tmpl Wed Jan 08 00:35:03 2014 +0900
@@ -124,7 +124,7 @@
<script type="text/javascript">
ajaxScrollInit(
- '{url|urlescape}graph/{rev}?revcount=%next%',
+ '{url|urlescape}graph/{rev}?revcount=%next%&style={style}',
{revcount}+60,
function (htmlText, previousVal) \{ return previousVal + 60; },
'#wrapper',
--- a/mercurial/templates/paper/shortlog.tmpl Wed Jan 08 00:26:55 2014 +0900
+++ b/mercurial/templates/paper/shortlog.tmpl Wed Jan 08 00:35:03 2014 +0900
@@ -73,7 +73,7 @@
<script type="text/javascript">
ajaxScrollInit(
- '{url|urlescape}shortlog/%next%',
+ '{url|urlescape}shortlog/%next%{sessionvars%urlparameter}',
'{nextentry%"{node}"}', <!-- NEXTHASH
function (htmlText, previousVal) \{
var m = htmlText.match(/'(\w+)', <!-- NEXTHASH/);
--- a/tests/test-hgweb-empty.t Wed Jan 08 00:26:55 2014 +0900
+++ b/tests/test-hgweb-empty.t Wed Jan 08 00:35:03 2014 +0900
@@ -361,7 +361,7 @@
<script type="text/javascript">
ajaxScrollInit(
- '/graph/-1?revcount=%next%',
+ '/graph/-1?revcount=%next%&style=paper',
60+60,
function (htmlText, previousVal) { return previousVal + 60; },
'#wrapper',