hgweb: avoid invalid infinity scroll request when overwritten web.style
authorTakumi IINO <trot.thunder@gmail.com>
Wed, 08 Jan 2014 00:35:03 +0900
changeset 20253 43cfad930d38
parent 20252 1bcf669084bb
child 20254 3896debf0a11
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.
mercurial/hgweb/hgweb_mod.py
mercurial/hgweb/hgwebdir_mod.py
mercurial/templates/paper/graph.tmpl
mercurial/templates/paper/shortlog.tmpl
tests/test-hgweb-empty.t
--- 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',