hgweb: change manifest archive links to only archive the current directory
authorAngel Ezquerra <angel.ezquerra@gmail.com>
Tue, 26 Feb 2013 21:20:35 +0100
changeset 18772 0bba1ff2ac7b
parent 18771 bb38f4f78104
child 18773 56dd55da2f7d
hgweb: change manifest archive links to only archive the current directory When the web server shows the manifest for a single, non top directory, append the path to the directory to the archive links. This makes the web server generate archive files that only include the current directory (and its subdirectories). Note that archive links in other pages (e.g. changeset) or at the top of the manifest are unchanged. Directory archive links have an extra "/" at the end which does not impact the result of the archive operation. Keeping it there made the implementation of this feature simpler.
mercurial/templates/coal/map
mercurial/templates/gitweb/map
mercurial/templates/monoblue/map
mercurial/templates/paper/map
--- a/mercurial/templates/coal/map	Sun Feb 10 11:52:05 2013 +0100
+++ b/mercurial/templates/coal/map	Tue Feb 26 21:20:35 2013 +0100
@@ -224,7 +224,7 @@
 index = ../paper/index.tmpl
 archiveentry = '
   <li>
-    <a href="{url|urlescape}archive/{node|short}{extension|urlescape}">{type|escape}</a>
+    <a href="{url|urlescape}archive/{node|short}{extension|urlescape}{ifeq(path,'/','',path|urlescape)}">{type|escape}</a>
   </li>'
 notfound = ../paper/notfound.tmpl
 error = ../paper/error.tmpl
--- a/mercurial/templates/gitweb/map	Sun Feb 10 11:52:05 2013 +0100
+++ b/mercurial/templates/gitweb/map	Tue Feb 26 21:20:35 2013 +0100
@@ -289,7 +289,7 @@
     <td class="link">
       <a href="{url|urlescape}file/{node|short}/{file|urlescape}{sessionvars%urlparameter}">file</a>&nbsp;|&nbsp;<a href="{url|urlescape}diff/{node|short}/{file|urlescape}{sessionvars%urlparameter}">diff</a>&nbsp;|&nbsp;<a href="{url|urlescape}annotate/{node|short}/{file|urlescape}{sessionvars%urlparameter}">annotate</a> {rename%filelogrename}</td>
     </tr>'
-archiveentry = ' | <a href="{url|urlescape}archive/{node|short}{extension}">{type|escape}</a> '
+archiveentry = ' | <a href="{url|urlescape}archive/{node|short}{extension}{ifeq(path,'/','',path|urlescape)}">{type|escape}</a> '
 indexentry = '
   <tr class="parity{parity}">
     <td>
--- a/mercurial/templates/monoblue/map	Sun Feb 10 11:52:05 2013 +0100
+++ b/mercurial/templates/monoblue/map	Tue Feb 26 21:20:35 2013 +0100
@@ -245,7 +245,7 @@
       {rename%filelogrename}
     </td>
   </tr>'
-archiveentry = '<li><a href="{url|urlescape}archive/{node|short}{extension}">{type|escape}</a></li>'
+archiveentry = '<li><a href="{url|urlescape}archive/{node|short}{extension}{ifeq(path,'/','',path|urlescape)}">{type|escape}</a></li>'
 indexentry = '
   <tr class="parity{parity}">
     <td><a href="{url|urlescape}{sessionvars%urlparameter}">{name|escape}</a></td>
--- a/mercurial/templates/paper/map	Sun Feb 10 11:52:05 2013 +0100
+++ b/mercurial/templates/paper/map	Tue Feb 26 21:20:35 2013 +0100
@@ -232,7 +232,7 @@
 index = index.tmpl
 archiveentry = '
   <li>
-    <a href="{url|urlescape}archive/{node|short}{extension|urlescape}">{type|escape}</a>
+    <a href="{url|urlescape}archive/{node|short}{extension|urlescape}{ifeq(path,'/','',path|urlescape)}">{type|escape}</a>
   </li>'
 notfound = notfound.tmpl
 error = error.tmpl