Patchwork [2,of,3] hgweb: don't point graph links at tip hash where it doesn't make sense

login
register
mail settings
Submitter Anton Shestakov
Date June 12, 2015, 10:55 a.m.
Message ID <69b9d331cbf3a8fe41d1.1434106536@neuro>
Download mbox | patch
Permalink /patch/9610/
State Accepted
Headers show

Comments

Anton Shestakov - June 12, 2015, 10:55 a.m.
# HG changeset patch
# User Anton Shestakov <av6@dwimlabs.net>
# Date 1434096599 -28800
#      Fri Jun 12 16:09:59 2015 +0800
# Node ID 69b9d331cbf3a8fe41d13c7c1853edf0b86dffca
# Parent  1f4d38cd8af693db2aa42f275e27853ac8607032
hgweb: don't point graph 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.

When monoblue style was added in 91b0ada2d94b, however, all graph links had
tried to point at some hash, and on such pages as described above it didn't
make sense. On error pages '{node|short}' is empty string anyway.

Of course, it worked, but seeing such 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 wasn't consistent with other template styles, other
pages in monoblue and even other links on the same page.

Let's just link to '/graph', which is equal to '/graph/tip'.

Patch

diff --git a/mercurial/templates/monoblue/bookmarks.tmpl b/mercurial/templates/monoblue/bookmarks.tmpl
--- a/mercurial/templates/monoblue/bookmarks.tmpl
+++ b/mercurial/templates/monoblue/bookmarks.tmpl
@@ -21,7 +21,7 @@ 
             <li><a href="{url|urlescape}summary{sessionvars%urlparameter}">summary</a></li>
             <li><a href="{url|urlescape}shortlog{sessionvars%urlparameter}">shortlog</a></li>
             <li><a href="{url|urlescape}changelog{sessionvars%urlparameter}">changelog</a></li>
-            <li><a href="{url|urlescape}graph/{node|short}{sessionvars%urlparameter}">graph</a></li>
+            <li><a href="{url|urlescape}graph{sessionvars%urlparameter}">graph</a></li>
             <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>
diff --git a/mercurial/templates/monoblue/branches.tmpl b/mercurial/templates/monoblue/branches.tmpl
--- a/mercurial/templates/monoblue/branches.tmpl
+++ b/mercurial/templates/monoblue/branches.tmpl
@@ -21,7 +21,7 @@ 
             <li><a href="{url|urlescape}summary{sessionvars%urlparameter}">summary</a></li>
             <li><a href="{url|urlescape}shortlog{sessionvars%urlparameter}">shortlog</a></li>
             <li><a href="{url|urlescape}changelog{sessionvars%urlparameter}">changelog</a></li>
-            <li><a href="{url|urlescape}graph/{node|short}{sessionvars%urlparameter}">graph</a></li>
+            <li><a href="{url|urlescape}graph{sessionvars%urlparameter}">graph</a></li>
             <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>
diff --git a/mercurial/templates/monoblue/error.tmpl b/mercurial/templates/monoblue/error.tmpl
--- a/mercurial/templates/monoblue/error.tmpl
+++ b/mercurial/templates/monoblue/error.tmpl
@@ -21,7 +21,7 @@ 
             <li class="current">summary</li>
             <li><a href="{url|urlescape}shortlog{sessionvars%urlparameter}">shortlog</a></li>
             <li><a href="{url|urlescape}log{sessionvars%urlparameter}">changelog</a></li>
-            <li><a href="{url|urlescape}graph/{node|short}{sessionvars%urlparameter}">graph</a></li>
+            <li><a href="{url|urlescape}graph{sessionvars%urlparameter}">graph</a></li>
             <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>
diff --git a/mercurial/templates/monoblue/help.tmpl b/mercurial/templates/monoblue/help.tmpl
--- a/mercurial/templates/monoblue/help.tmpl
+++ b/mercurial/templates/monoblue/help.tmpl
@@ -21,7 +21,7 @@ 
             <li><a href="{url|urlescape}summary{sessionvars%urlparameter}">summary</a></li>
             <li><a href="{url|urlescape}shortlog{sessionvars%urlparameter}">shortlog</a></li>
             <li><a href="{url|urlescape}changelog{sessionvars%urlparameter}">changelog</a></li>
-            <li><a href="{url|urlescape}graph/{node|short}{sessionvars%urlparameter}">graph</a></li>
+            <li><a href="{url|urlescape}graph{sessionvars%urlparameter}">graph</a></li>
             <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>
diff --git a/mercurial/templates/monoblue/helptopics.tmpl b/mercurial/templates/monoblue/helptopics.tmpl
--- a/mercurial/templates/monoblue/helptopics.tmpl
+++ b/mercurial/templates/monoblue/helptopics.tmpl
@@ -21,7 +21,7 @@ 
             <li><a href="{url|urlescape}summary{sessionvars%urlparameter}">summary</a></li>
             <li><a href="{url|urlescape}shortlog{sessionvars%urlparameter}">shortlog</a></li>
             <li><a href="{url|urlescape}changelog{sessionvars%urlparameter}">changelog</a></li>
-            <li><a href="{url|urlescape}graph/{node|short}{sessionvars%urlparameter}">graph</a></li>
+            <li><a href="{url|urlescape}graph{sessionvars%urlparameter}">graph</a></li>
             <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>
diff --git a/mercurial/templates/monoblue/notfound.tmpl b/mercurial/templates/monoblue/notfound.tmpl
--- a/mercurial/templates/monoblue/notfound.tmpl
+++ b/mercurial/templates/monoblue/notfound.tmpl
@@ -21,7 +21,7 @@ 
             <li class="current">summary</li>
             <li><a href="{url|urlescape}shortlog{sessionvars%urlparameter}">shortlog</a></li>
             <li><a href="{url|urlescape}log{sessionvars%urlparameter}">changelog</a></li>
-            <li><a href="{url|urlescape}graph/{node|short}{sessionvars%urlparameter}">graph</a></li>
+            <li><a href="{url|urlescape}graph{sessionvars%urlparameter}">graph</a></li>
             <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>
diff --git a/mercurial/templates/monoblue/search.tmpl b/mercurial/templates/monoblue/search.tmpl
--- a/mercurial/templates/monoblue/search.tmpl
+++ b/mercurial/templates/monoblue/search.tmpl
@@ -21,7 +21,7 @@ 
             <li><a href="{url|urlescape}summary{sessionvars%urlparameter}">summary</a></li>
             <li><a href="{url|urlescape}shortlog{sessionvars%urlparameter}">shortlog</a></li>
             <li><a href="{url|urlescape}log{sessionvars%urlparameter}">changelog</a></li>
-            <li><a href="{url|urlescape}graph/{node|short}{sessionvars%urlparameter}">graph</a></li>
+            <li><a href="{url|urlescape}graph{sessionvars%urlparameter}">graph</a></li>
             <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>
diff --git a/mercurial/templates/monoblue/summary.tmpl b/mercurial/templates/monoblue/summary.tmpl
--- a/mercurial/templates/monoblue/summary.tmpl
+++ b/mercurial/templates/monoblue/summary.tmpl
@@ -21,7 +21,7 @@ 
             <li class="current">summary</li>
             <li><a href="{url|urlescape}shortlog{sessionvars%urlparameter}">shortlog</a></li>
             <li><a href="{url|urlescape}log{sessionvars%urlparameter}">changelog</a></li>
-            <li><a href="{url|urlescape}graph/{node|short}{sessionvars%urlparameter}">graph</a></li>
+            <li><a href="{url|urlescape}graph{sessionvars%urlparameter}">graph</a></li>
             <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>
diff --git a/mercurial/templates/monoblue/tags.tmpl b/mercurial/templates/monoblue/tags.tmpl
--- a/mercurial/templates/monoblue/tags.tmpl
+++ b/mercurial/templates/monoblue/tags.tmpl
@@ -21,7 +21,7 @@ 
             <li><a href="{url|urlescape}summary{sessionvars%urlparameter}">summary</a></li>
             <li><a href="{url|urlescape}shortlog{sessionvars%urlparameter}">shortlog</a></li>
             <li><a href="{url|urlescape}changelog{sessionvars%urlparameter}">changelog</a></li>
-            <li><a href="{url|urlescape}graph/{node|short}{sessionvars%urlparameter}">graph</a></li>
+            <li><a href="{url|urlescape}graph{sessionvars%urlparameter}">graph</a></li>
             <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>