hgweb: add archive entries to graph page
authorAnton Shestakov <av6@dwimlabs.net>
Thu, 28 Jun 2018 10:50:53 +0800
changeset 38486 5faaa31a6082
parent 38485 a8872a820242
child 38487 3efadf2317c7
hgweb: add archive entries to graph page Changelog page has them, so it makes sense to add them to graph page too.
mercurial/hgweb/webcommands.py
mercurial/templates/gitweb/graph.tmpl
mercurial/templates/monoblue/graph.tmpl
mercurial/templates/paper/graph.tmpl
tests/test-hgweb-empty.t
tests/test-hgweb-symrev.t
--- a/mercurial/hgweb/webcommands.py	Thu Jun 28 07:41:08 2018 +0800
+++ b/mercurial/hgweb/webcommands.py	Thu Jun 28 10:50:53 2018 +0800
@@ -1370,6 +1370,7 @@
         jsdata=templateutil.mappinggenerator(jsdata),
         nodes=templateutil.mappinggenerator(nodes),
         node=ctx.hex(),
+        archives=web.archivelist('tip'),
         changenav=changenav)
 
 def _getdoc(e):
--- a/mercurial/templates/gitweb/graph.tmpl	Thu Jun 28 07:41:08 2018 +0800
+++ b/mercurial/templates/gitweb/graph.tmpl	Thu Jun 28 10:50:53 2018 +0800
@@ -21,7 +21,7 @@
 <a href="{url|urlescape}tags{sessionvars%urlparameter}">tags</a> |
 <a href="{url|urlescape}bookmarks{sessionvars%urlparameter}">bookmarks</a> |
 <a href="{url|urlescape}branches{sessionvars%urlparameter}">branches</a> |
-<a href="{url|urlescape}file/{symrev}{sessionvars%urlparameter}">files</a> |
+<a href="{url|urlescape}file/{symrev}{sessionvars%urlparameter}">files</a>{archives%archiveentry} |
 <a href="{url|urlescape}help{sessionvars%urlparameter}">help</a>
 <br/>
 <a href="{url|urlescape}graph/{symrev}{lessvars%urlparameter}">less</a>
--- a/mercurial/templates/monoblue/graph.tmpl	Thu Jun 28 07:41:08 2018 +0800
+++ b/mercurial/templates/monoblue/graph.tmpl	Thu Jun 28 10:50:53 2018 +0800
@@ -20,6 +20,7 @@
             <li><a href="{url|urlescape}bookmarks{sessionvars%urlparameter}">bookmarks</a></li>
             <li><a href="{url|urlescape}branches{sessionvars%urlparameter}">branches</a></li>
             <li><a href="{url|urlescape}file/{symrev}{sessionvars%urlparameter}">files</a></li>
+            {archives%archiveentry}
             <li><a href="{url|urlescape}help{sessionvars%urlparameter}">help</a></li>
         </ul>
     </div>
--- a/mercurial/templates/paper/graph.tmpl	Thu Jun 28 07:41:08 2018 +0800
+++ b/mercurial/templates/paper/graph.tmpl	Thu Jun 28 10:50:53 2018 +0800
@@ -25,6 +25,9 @@
 <li><a href="{url|urlescape}file/{symrev}{path|urlescape}{sessionvars%urlparameter}">browse</a></li>
 </ul>
 <ul>
+{archives%archiveentry}
+</ul>
+<ul>
  <li><a href="{url|urlescape}help{sessionvars%urlparameter}">help</a></li>
 </ul>
 <div class="atom-logo">
--- a/tests/test-hgweb-empty.t	Thu Jun 28 07:41:08 2018 +0800
+++ b/tests/test-hgweb-empty.t	Thu Jun 28 10:50:53 2018 +0800
@@ -263,6 +263,9 @@
   <li><a href="/file/tip">browse</a></li>
   </ul>
   <ul>
+  
+  </ul>
+  <ul>
    <li><a href="/help">help</a></li>
   </ul>
   <div class="atom-logo">
--- a/tests/test-hgweb-symrev.t	Thu Jun 28 07:41:08 2018 +0800
+++ b/tests/test-hgweb-symrev.t	Thu Jun 28 10:50:53 2018 +0800
@@ -56,6 +56,7 @@
   <li><a href="/shortlog/tip?style=paper">log</a></li>
   <li><a href="/rev/tip?style=paper">changeset</a></li>
   <li><a href="/file/tip?style=paper">browse</a></li>
+  <a href="/archive/tip.zip">zip</a>
   <a href="/graph/tip?revcount=30&style=paper">less</a>
   <a href="/graph/tip?revcount=120&style=paper">more</a>
   | rev 2: <a href="/graph/43c799df6e75?style=paper">(0)</a> <a href="/graph/tip?style=paper">tip</a> 
@@ -122,6 +123,7 @@
   <li><a href="/shortlog/xyzzy?style=paper">log</a></li>
   <li><a href="/rev/xyzzy?style=paper">changeset</a></li>
   <li><a href="/file/xyzzy?style=paper">browse</a></li>
+  <a href="/archive/xyzzy.zip">zip</a>
   <a href="/graph/xyzzy?revcount=30&style=paper">less</a>
   <a href="/graph/xyzzy?revcount=120&style=paper">more</a>
   | rev 1: <a href="/graph/43c799df6e75?style=paper">(0)</a> <a href="/graph/tip?style=paper">tip</a> 
@@ -254,6 +256,7 @@
   <li><a href="/shortlog/tip?style=coal">log</a></li>
   <li><a href="/rev/tip?style=coal">changeset</a></li>
   <li><a href="/file/tip?style=coal">browse</a></li>
+  <a href="/archive/tip.zip">zip</a>
   <a href="/graph/tip?revcount=30&style=coal">less</a>
   <a href="/graph/tip?revcount=120&style=coal">more</a>
   | rev 2: <a href="/graph/43c799df6e75?style=coal">(0)</a> <a href="/graph/tip?style=coal">tip</a> 
@@ -320,6 +323,7 @@
   <li><a href="/shortlog/xyzzy?style=coal">log</a></li>
   <li><a href="/rev/xyzzy?style=coal">changeset</a></li>
   <li><a href="/file/xyzzy?style=coal">browse</a></li>
+  <a href="/archive/xyzzy.zip">zip</a>
   <a href="/graph/xyzzy?revcount=30&style=coal">less</a>
   <a href="/graph/xyzzy?revcount=120&style=coal">more</a>
   | rev 1: <a href="/graph/43c799df6e75?style=coal">(0)</a> <a href="/graph/tip?style=coal">tip</a> 
@@ -485,7 +489,7 @@
   $ "$TESTDIR/get-with-headers.py" $LOCALIP:$HGPORT 'graph?style=gitweb' | egrep $REVLINKS
   <a href="/shortlog/tip?style=gitweb">shortlog</a> |
   <a href="/log/tip?style=gitweb">changelog</a> |
-  <a href="/file/tip?style=gitweb">files</a> |
+  <a href="/file/tip?style=gitweb">files</a> | <a href="/archive/tip.zip">zip</a>  |
   <a href="/graph/tip?revcount=30&style=gitweb">less</a>
   <a href="/graph/tip?revcount=120&style=gitweb">more</a>
   | <a href="/graph/43c799df6e75?style=gitweb">(0)</a> <a href="/graph/tip?style=gitweb">tip</a> 
@@ -577,7 +581,7 @@
   $ "$TESTDIR/get-with-headers.py" $LOCALIP:$HGPORT 'graph/xyzzy?style=gitweb' | egrep $REVLINKS
   <a href="/shortlog/xyzzy?style=gitweb">shortlog</a> |
   <a href="/log/xyzzy?style=gitweb">changelog</a> |
-  <a href="/file/xyzzy?style=gitweb">files</a> |
+  <a href="/file/xyzzy?style=gitweb">files</a> | <a href="/archive/xyzzy.zip">zip</a>  |
   <a href="/graph/xyzzy?revcount=30&style=gitweb">less</a>
   <a href="/graph/xyzzy?revcount=120&style=gitweb">more</a>
   | <a href="/graph/43c799df6e75?style=gitweb">(0)</a> <a href="/graph/tip?style=gitweb">tip</a> 
@@ -725,6 +729,7 @@
 
   $ "$TESTDIR/get-with-headers.py" $LOCALIP:$HGPORT 'graph?style=monoblue' | egrep $REVLINKS
               <li><a href="/file/tip?style=monoblue">files</a></li>
+              <li><a href="/archive/tip.zip">zip</a></li>
               <a href="/rev/9d8c40cba617?style=monoblue">third</a>
               <a href="/rev/a7c1559b7bba?style=monoblue">second</a>
               <a href="/rev/43c799df6e75?style=monoblue">first</a>
@@ -806,6 +811,7 @@
 
   $ "$TESTDIR/get-with-headers.py" $LOCALIP:$HGPORT 'graph/xyzzy?style=monoblue' | egrep $REVLINKS
               <li><a href="/file/xyzzy?style=monoblue">files</a></li>
+              <li><a href="/archive/xyzzy.zip">zip</a></li>
               <a href="/rev/a7c1559b7bba?style=monoblue">second</a>
               <a href="/rev/43c799df6e75?style=monoblue">first</a>
           <a href="/graph/xyzzy?revcount=30&style=monoblue">less</a>