hgweb: don't point file links at tip hash where it doesn't make sense
authorAnton Shestakov <av6@dwimlabs.net>
Fri, 12 Jun 2015 18:34:10 +0800
changeset 25526 32f76eccbced
parent 25525 bcc02516f384
child 25527 262e6ad93885
hgweb: don't point file links at tip hash where it doesn't make sense Some pages, e.g. bookmarks, help and summary don't have a meaningful revision context: they always either show information about tip or about the whole repo (and not about any specific changeset). And error pages can just show hgweb error messages, not related to any repo or changeset. Having a hash in the links worked (even when '{node|short}' resolved to an empty string on error pages), but seeing pages without revision context provide links with hashes is a bit confusing (unless you keep current tip hash in your head at all times) and not consistent with other template styles and other links on the same page: they don't have a hash. Let's just link to '/file', which is equal to '/file/tip'.
mercurial/templates/gitweb/bookmarks.tmpl
mercurial/templates/gitweb/branches.tmpl
mercurial/templates/gitweb/error.tmpl
mercurial/templates/gitweb/help.tmpl
mercurial/templates/gitweb/helptopics.tmpl
mercurial/templates/gitweb/search.tmpl
mercurial/templates/gitweb/summary.tmpl
mercurial/templates/gitweb/tags.tmpl
mercurial/templates/monoblue/bookmarks.tmpl
mercurial/templates/monoblue/branches.tmpl
mercurial/templates/monoblue/error.tmpl
mercurial/templates/monoblue/help.tmpl
mercurial/templates/monoblue/helptopics.tmpl
mercurial/templates/monoblue/notfound.tmpl
mercurial/templates/monoblue/search.tmpl
mercurial/templates/monoblue/summary.tmpl
mercurial/templates/monoblue/tags.tmpl
mercurial/templates/spartan/branches.tmpl
mercurial/templates/spartan/search.tmpl
mercurial/templates/spartan/tags.tmpl
tests/test-hgweb-commands.t
--- a/mercurial/templates/gitweb/bookmarks.tmpl	Fri Jun 12 16:09:59 2015 +0800
+++ b/mercurial/templates/gitweb/bookmarks.tmpl	Fri Jun 12 18:34:10 2015 +0800
@@ -20,7 +20,7 @@
 <a href="{url|urlescape}tags{sessionvars%urlparameter}">tags</a> |
 bookmarks |
 <a href="{url|urlescape}branches{sessionvars%urlparameter}">branches</a> |
-<a href="{url|urlescape}file/{node|short}{sessionvars%urlparameter}">files</a> |
+<a href="{url|urlescape}file{sessionvars%urlparameter}">files</a> |
 <a href="{url|urlescape}help{sessionvars%urlparameter}">help</a>
 <br/>
 </div>
--- a/mercurial/templates/gitweb/branches.tmpl	Fri Jun 12 16:09:59 2015 +0800
+++ b/mercurial/templates/gitweb/branches.tmpl	Fri Jun 12 18:34:10 2015 +0800
@@ -20,7 +20,7 @@
 <a href="{url|urlescape}tags{sessionvars%urlparameter}">tags</a> |
 <a href="{url|urlescape}bookmarks{sessionvars%urlparameter}">bookmarks</a> |
 branches |
-<a href="{url|urlescape}file/{node|short}{sessionvars%urlparameter}">files</a> |
+<a href="{url|urlescape}file{sessionvars%urlparameter}">files</a> |
 <a href="{url|urlescape}help{sessionvars%urlparameter}">help</a>
 <br/>
 </div>
--- a/mercurial/templates/gitweb/error.tmpl	Fri Jun 12 16:09:59 2015 +0800
+++ b/mercurial/templates/gitweb/error.tmpl	Fri Jun 12 18:34:10 2015 +0800
@@ -19,7 +19,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/{node|short}{sessionvars%urlparameter}">files</a> |
+<a href="{url|urlescape}file{sessionvars%urlparameter}">files</a> |
 <a href="{url|urlescape}help{sessionvars%urlparameter}">help</a>
 <br/>
 </div>
--- a/mercurial/templates/gitweb/help.tmpl	Fri Jun 12 16:09:59 2015 +0800
+++ b/mercurial/templates/gitweb/help.tmpl	Fri Jun 12 18:34:10 2015 +0800
@@ -20,7 +20,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/{node|short}{sessionvars%urlparameter}">files</a> |
+<a href="{url|urlescape}file{sessionvars%urlparameter}">files</a> |
 help
 <br/>
 </div>
--- a/mercurial/templates/gitweb/helptopics.tmpl	Fri Jun 12 16:09:59 2015 +0800
+++ b/mercurial/templates/gitweb/helptopics.tmpl	Fri Jun 12 18:34:10 2015 +0800
@@ -20,7 +20,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/{node|short}{sessionvars%urlparameter}">files</a> |
+<a href="{url|urlescape}file{sessionvars%urlparameter}">files</a> |
 help
 <br/>
 </div>
--- a/mercurial/templates/gitweb/search.tmpl	Fri Jun 12 16:09:59 2015 +0800
+++ b/mercurial/templates/gitweb/search.tmpl	Fri Jun 12 18:34:10 2015 +0800
@@ -27,7 +27,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/{node|short}{sessionvars%urlparameter}">files</a>{archives%archiveentry}
+<a href="{url|urlescape}file{sessionvars%urlparameter}">files</a>{archives%archiveentry}
  |
  <a href="{url|urlescape}help{sessionvars%urlparameter}">help</a>
 <br/>
--- a/mercurial/templates/gitweb/summary.tmpl	Fri Jun 12 16:09:59 2015 +0800
+++ b/mercurial/templates/gitweb/summary.tmpl	Fri Jun 12 18:34:10 2015 +0800
@@ -26,7 +26,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/{node|short}{sessionvars%urlparameter}">files</a>{archives%archiveentry} |
+<a href="{url|urlescape}file{sessionvars%urlparameter}">files</a>{archives%archiveentry} |
 <a href="{url|urlescape}help{sessionvars%urlparameter}">help</a>
 <br/>
 </div>
--- a/mercurial/templates/gitweb/tags.tmpl	Fri Jun 12 16:09:59 2015 +0800
+++ b/mercurial/templates/gitweb/tags.tmpl	Fri Jun 12 18:34:10 2015 +0800
@@ -20,7 +20,7 @@
 tags |
 <a href="{url|urlescape}bookmarks{sessionvars%urlparameter}">bookmarks</a> |
 <a href="{url|urlescape}branches{sessionvars%urlparameter}">branches</a> |
-<a href="{url|urlescape}file/{node|short}{sessionvars%urlparameter}">files</a> |
+<a href="{url|urlescape}file{sessionvars%urlparameter}">files</a> |
 <a href="{url|urlescape}help{sessionvars%urlparameter}">help</a>
 <br/>
 </div>
--- a/mercurial/templates/monoblue/bookmarks.tmpl	Fri Jun 12 16:09:59 2015 +0800
+++ b/mercurial/templates/monoblue/bookmarks.tmpl	Fri Jun 12 18:34:10 2015 +0800
@@ -25,7 +25,7 @@
             <li><a href="{url|urlescape}tags{sessionvars%urlparameter}">tags</a></li>
             <li class="current">bookmarks</li>
             <li><a href="{url|urlescape}branches{sessionvars%urlparameter}">branches</a></li>
-            <li><a href="{url|urlescape}file/{node|short}{sessionvars%urlparameter}">files</a></li>
+            <li><a href="{url|urlescape}file{sessionvars%urlparameter}">files</a></li>
             <li><a href="{url|urlescape}help{sessionvars%urlparameter}">help</a></li>
         </ul>
     </div>
--- a/mercurial/templates/monoblue/branches.tmpl	Fri Jun 12 16:09:59 2015 +0800
+++ b/mercurial/templates/monoblue/branches.tmpl	Fri Jun 12 18:34:10 2015 +0800
@@ -25,7 +25,7 @@
             <li><a href="{url|urlescape}tags{sessionvars%urlparameter}">tags</a></li>
             <li><a href="{url|urlescape}bookmarks{sessionvars%urlparameter}">bookmarks</a></li>
             <li class="current">branches</li>
-            <li><a href="{url|urlescape}file/{node|short}{sessionvars%urlparameter}">files</a></li>
+            <li><a href="{url|urlescape}file{sessionvars%urlparameter}">files</a></li>
             <li><a href="{url|urlescape}help{sessionvars%urlparameter}">help</a></li>
         </ul>
     </div>
--- a/mercurial/templates/monoblue/error.tmpl	Fri Jun 12 16:09:59 2015 +0800
+++ b/mercurial/templates/monoblue/error.tmpl	Fri Jun 12 18:34:10 2015 +0800
@@ -25,7 +25,7 @@
             <li><a href="{url|urlescape}tags{sessionvars%urlparameter}">tags</a></li>
             <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/{node|short}{sessionvars%urlparameter}">files</a></li>
+            <li><a href="{url|urlescape}file{sessionvars%urlparameter}">files</a></li>
             <li><a href="{url|urlescape}help{sessionvars%urlparameter}">help</a></li>
         </ul>
     </div>
--- a/mercurial/templates/monoblue/help.tmpl	Fri Jun 12 16:09:59 2015 +0800
+++ b/mercurial/templates/monoblue/help.tmpl	Fri Jun 12 18:34:10 2015 +0800
@@ -25,7 +25,7 @@
             <li><a href="{url|urlescape}tags{sessionvars%urlparameter}">tags</a></li>
             <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/{node|short}{sessionvars%urlparameter}">files</a></li>
+            <li><a href="{url|urlescape}file{sessionvars%urlparameter}">files</a></li>
             <li class="current">help</li>
         </ul>
     </div>
--- a/mercurial/templates/monoblue/helptopics.tmpl	Fri Jun 12 16:09:59 2015 +0800
+++ b/mercurial/templates/monoblue/helptopics.tmpl	Fri Jun 12 18:34:10 2015 +0800
@@ -25,7 +25,7 @@
             <li><a href="{url|urlescape}tags{sessionvars%urlparameter}">tags</a></li>
             <li><a href="{url|urlescape}bookmarks{sessionvars%urlparameter}">bookmarks</a></li>
             <li><a href="{url|urlescape}help{sessionvars%urlparameter}">branches</a></li>
-            <li><a href="{url|urlescape}file/{node|short}{sessionvars%urlparameter}">files</a></li>
+            <li><a href="{url|urlescape}file{sessionvars%urlparameter}">files</a></li>
             <li class="current">help</li>
         </ul>
     </div>
--- a/mercurial/templates/monoblue/notfound.tmpl	Fri Jun 12 16:09:59 2015 +0800
+++ b/mercurial/templates/monoblue/notfound.tmpl	Fri Jun 12 18:34:10 2015 +0800
@@ -25,7 +25,7 @@
             <li><a href="{url|urlescape}tags{sessionvars%urlparameter}">tags</a></li>
             <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/{node|short}{sessionvars%urlparameter}">files</a></li>
+            <li><a href="{url|urlescape}file{sessionvars%urlparameter}">files</a></li>
             {archives%archiveentry}
             <li><a href="{url|urlescape}help{sessionvars%urlparameter}">help</a></li>
         </ul>
--- a/mercurial/templates/monoblue/search.tmpl	Fri Jun 12 16:09:59 2015 +0800
+++ b/mercurial/templates/monoblue/search.tmpl	Fri Jun 12 18:34:10 2015 +0800
@@ -25,7 +25,7 @@
             <li><a href="{url|urlescape}tags{sessionvars%urlparameter}">tags</a></li>
             <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/{node|short}{sessionvars%urlparameter}">files</a></li>
+            <li><a href="{url|urlescape}file{sessionvars%urlparameter}">files</a></li>
             {archives%archiveentry}
             <li><a href="{url|urlescape}help{sessionvars%urlparameter}">help</a></li>
         </ul>
--- a/mercurial/templates/monoblue/summary.tmpl	Fri Jun 12 16:09:59 2015 +0800
+++ b/mercurial/templates/monoblue/summary.tmpl	Fri Jun 12 18:34:10 2015 +0800
@@ -25,7 +25,7 @@
             <li><a href="{url|urlescape}tags{sessionvars%urlparameter}">tags</a></li>
             <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/{node|short}{sessionvars%urlparameter}">files</a></li>
+            <li><a href="{url|urlescape}file{sessionvars%urlparameter}">files</a></li>
             <li><a href="{url|urlescape}help{sessionvars%urlparameter}">help</a></li>
         </ul>
     </div>
--- a/mercurial/templates/monoblue/tags.tmpl	Fri Jun 12 16:09:59 2015 +0800
+++ b/mercurial/templates/monoblue/tags.tmpl	Fri Jun 12 18:34:10 2015 +0800
@@ -25,7 +25,7 @@
             <li class="current">tags</li>
             <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/{node|short}{sessionvars%urlparameter}">files</a></li>
+            <li><a href="{url|urlescape}file{sessionvars%urlparameter}">files</a></li>
             <li><a href="{url|urlescape}help{sessionvars%urlparameter}">help</a></li>
         </ul>
     </div>
--- a/mercurial/templates/spartan/branches.tmpl	Fri Jun 12 16:09:59 2015 +0800
+++ b/mercurial/templates/spartan/branches.tmpl	Fri Jun 12 18:34:10 2015 +0800
@@ -12,7 +12,7 @@
 <a href="{url|urlescape}shortlog{sessionvars%urlparameter}">shortlog</a>
 <a href="{url|urlescape}graph{sessionvars%urlparameter}">graph</a>
 <a href="{url|urlescape}tags{sessionvars%urlparameter}">tags</a>
-<a href="{url|urlescape}file/{node|short}/{sessionvars%urlparameter}">files</a>
+<a href="{url|urlescape}file{sessionvars%urlparameter}">files</a>
 <a href="{url|urlescape}help{sessionvars%urlparameter}">help</a>
 <a type="application/rss+xml" href="{url|urlescape}rss-branches">rss</a>
 <a type="application/atom+xml" href="{url|urlescape}atom-branches">atom</a>
--- a/mercurial/templates/spartan/search.tmpl	Fri Jun 12 16:09:59 2015 +0800
+++ b/mercurial/templates/spartan/search.tmpl	Fri Jun 12 18:34:10 2015 +0800
@@ -9,7 +9,7 @@
 <a href="{url|urlescape}graph{sessionvars%urlparameter}">graph</a>
 <a href="{url|urlescape}tags{sessionvars%urlparameter}">tags</a>
 <a href="{url|urlescape}branches{sessionvars%urlparameter}">branches</a>
-<a href="{url|urlescape}file/{node|short}{sessionvars%urlparameter}">files</a>
+<a href="{url|urlescape}file{sessionvars%urlparameter}">files</a>
 {archives%archiveentry}
 <a href="{url|urlescape}help{sessionvars%urlparameter}">help</a>
 </div>
--- a/mercurial/templates/spartan/tags.tmpl	Fri Jun 12 16:09:59 2015 +0800
+++ b/mercurial/templates/spartan/tags.tmpl	Fri Jun 12 18:34:10 2015 +0800
@@ -12,7 +12,7 @@
 <a href="{url|urlescape}shortlog{sessionvars%urlparameter}">shortlog</a>
 <a href="{url|urlescape}graph{sessionvars%urlparameter}">graph</a>
 <a href="{url|urlescape}branches{sessionvars%urlparameter}">branches</a>
-<a href="{url|urlescape}file/{node|short}/{sessionvars%urlparameter}">files</a>
+<a href="{url|urlescape}file{sessionvars%urlparameter}">files</a>
 <a href="{url|urlescape}help{sessionvars%urlparameter}">help</a>
 <a type="application/rss+xml" href="{url|urlescape}rss-tags">rss</a>
 <a type="application/atom+xml" href="{url|urlescape}atom-tags">atom</a>
--- a/tests/test-hgweb-commands.t	Fri Jun 12 16:09:59 2015 +0800
+++ b/tests/test-hgweb-commands.t	Fri Jun 12 18:34:10 2015 +0800
@@ -1525,7 +1525,7 @@
   <a href="/tags?style=gitweb">tags</a> |
   <a href="/bookmarks?style=gitweb">bookmarks</a> |
   <a href="/branches?style=gitweb">branches</a> |
-  <a href="/file/cad8025a2e87?style=gitweb">files</a> |
+  <a href="/file?style=gitweb">files</a> |
   <a href="/help?style=gitweb">help</a>
   <br/>
   </div>