changeset 35064:9acc0360ff67

hgweb: move changeset "tags" to a template in map file (paper and coal) This patch puts all these changeset "tags" into one template shared everywhere in paper and coal themes. But it should be noted that some of the templates had different sets of tags, in some cases it was intended, in others - most likely not. First, what's up with all these different ways to get changeset's branch. There are actually 3 ways to do it in hgweb, they can all be seen in this patch; "branches", "inbranch" and "branch". They are all lists that consist of 1 or 0 items: - "branches" has ctx.branch() if current changeset is the tip of that branch - "inbranch" has ctx.branch() if current changeset is _not_ the tip of that branch and the branch is not "default" - "branch" aka "changesetbranch" has ctx.branch() if the branch is not "default" The majority of cases (7 vs 2 + /graph) in paper theme used only option 3, which meant that "default" was never displayed. But other parts of the theme disagreed with this and used option 1 and option 2 together. For example, the default view (log) displays "default" on the branch tip (can be seen right about now on m-s.o/repo/hg), but it disappears when you click on the commit. Also, using option 3 alone meant that there was no way to tell if a changeset is the tip of its branch or not (it was always assumed that it's not, see how some css classes change from "branchname" to the correct "branchhead" in tests) -- so the two different css styles that exist in paper just for this were underused. I think this patch improves the situation, even though it changes the old (even if inconsistent) behavior. The new behavior matches that of gitweb and monoblue.
author Anton Shestakov <av6@dwimlabs.net>
date Wed, 15 Nov 2017 23:55:09 +0800
parents 52790352dd05
children a1de4ffaa7a8
files mercurial/templates/paper/changeset.tmpl mercurial/templates/paper/fileannotate.tmpl mercurial/templates/paper/filecomparison.tmpl mercurial/templates/paper/filediff.tmpl mercurial/templates/paper/filelog.tmpl mercurial/templates/paper/filelogentry.tmpl mercurial/templates/paper/filerevision.tmpl mercurial/templates/paper/manifest.tmpl mercurial/templates/paper/map mercurial/templates/paper/shortlogentry.tmpl tests/test-hgweb-commands.t tests/test-hgweb-descend-empties.t tests/test-hgweb-diffs.t tests/test-hgweb-filelog.t tests/test-hgweb-removed.t tests/test-hgweb.t tests/test-highlight.t
diffstat 17 files changed, 27 insertions(+), 26 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/templates/paper/changeset.tmpl	Fri Nov 03 21:01:20 2017 +0100
+++ b/mercurial/templates/paper/changeset.tmpl	Wed Nov 15 23:55:09 2017 +0800
@@ -33,7 +33,7 @@
 <h2 class="breadcrumb"><a href="/">Mercurial</a> {pathdef%breadcrumb}</h2>
 <h3>
  changeset {rev}:<a href="{url|urlescape}rev/{node|short}{sessionvars%urlparameter}">{node|short}</a>
- {changesetbranch%changelogbranchname}{changesettag}{changesetbookmark}
+ {alltags}
 </h3>
 
 {searchform}
--- a/mercurial/templates/paper/fileannotate.tmpl	Fri Nov 03 21:01:20 2017 +0100
+++ b/mercurial/templates/paper/fileannotate.tmpl	Wed Nov 15 23:55:09 2017 +0800
@@ -39,7 +39,7 @@
 <h2 class="breadcrumb"><a href="/">Mercurial</a> {pathdef%breadcrumb}</h2>
 <h3>
  annotate {file|escape} @ {rev}:<a href="{url|urlescape}rev/{node|short}{sessionvars%urlparameter}">{node|short}</a>
- {branch%changelogbranchname}{tags%changelogtag}{bookmarks%changelogtag}
+ {alltags}
 </h3>
 
 {searchform}
--- a/mercurial/templates/paper/filecomparison.tmpl	Fri Nov 03 21:01:20 2017 +0100
+++ b/mercurial/templates/paper/filecomparison.tmpl	Wed Nov 15 23:55:09 2017 +0800
@@ -38,7 +38,7 @@
 <h2 class="breadcrumb"><a href="/">Mercurial</a> {pathdef%breadcrumb}</h2>
 <h3>
  comparison {file|escape} @ {rev}:<a href="{url|urlescape}rev/{node|short}{sessionvars%urlparameter}">{node|short}</a>
- {branch%changelogbranchname}{tags%changelogtag}{bookmarks%changelogtag}
+ {alltags}
 </h3>
 
 {searchform}
--- a/mercurial/templates/paper/filediff.tmpl	Fri Nov 03 21:01:20 2017 +0100
+++ b/mercurial/templates/paper/filediff.tmpl	Wed Nov 15 23:55:09 2017 +0800
@@ -38,7 +38,7 @@
 <h2 class="breadcrumb"><a href="/">Mercurial</a> {pathdef%breadcrumb}</h2>
 <h3>
  diff {file|escape} @ {rev}:<a href="{url|urlescape}rev/{node|short}{sessionvars%urlparameter}">{node|short}</a>
- {branch%changelogbranchname}{tags%changelogtag}{bookmarks%changelogtag}
+ {alltags}
 </h3>
 
 {searchform}
--- a/mercurial/templates/paper/filelog.tmpl	Fri Nov 03 21:01:20 2017 +0100
+++ b/mercurial/templates/paper/filelog.tmpl	Wed Nov 15 23:55:09 2017 +0800
@@ -46,7 +46,7 @@
 <h2 class="breadcrumb"><a href="/">Mercurial</a> {pathdef%breadcrumb}</h2>
 <h3>
  log {file|escape} @ {rev}:<a href="{url|urlescape}rev/{node|short}{sessionvars%urlparameter}">{node|short}</a>
- {branch%changelogbranchname}{tags%changelogtag}{bookmarks%changelogtag}
+ {alltags}
  {if(linerange,
 ' (following lines {linerange}{if(descend, ', descending')} <a href="{url|urlescape}log/{symrev}/{file|urlescape}{sessionvars%urlparameter}">back to filelog</a>)')}
 </h3>
--- a/mercurial/templates/paper/filelogentry.tmpl	Fri Nov 03 21:01:20 2017 +0100
+++ b/mercurial/templates/paper/filelogentry.tmpl	Wed Nov 15 23:55:09 2017 +0800
@@ -3,7 +3,7 @@
   <td class="author">{author|person}</td>
   <td class="description">
    <a href="{url|urlescape}rev/{node|short}{sessionvars%urlparameter}">{desc|strip|firstline|escape|nonempty}</a>
-   {inbranch%changelogbranchname}{branches%changelogbranchhead}{tags%changelogtag}{bookmarks%changelogtag}{rename%filelogrename}
+   {alltags}{rename%filelogrename}
   </td>
  </tr>
  {if(patch, '<tr><td colspan="3">{diff}</td></tr>')}
--- a/mercurial/templates/paper/filerevision.tmpl	Fri Nov 03 21:01:20 2017 +0100
+++ b/mercurial/templates/paper/filerevision.tmpl	Wed Nov 15 23:55:09 2017 +0800
@@ -38,7 +38,7 @@
 <h2 class="breadcrumb"><a href="/">Mercurial</a> {pathdef%breadcrumb}</h2>
 <h3>
  view {file|escape} @ {rev}:<a href="{url|urlescape}rev/{node|short}{sessionvars%urlparameter}">{node|short}</a>
- {branch%changelogbranchname}{tags%changelogtag}{bookmarks%changelogtag}
+ {alltags}
 </h3>
 
 {searchform}
--- a/mercurial/templates/paper/manifest.tmpl	Fri Nov 03 21:01:20 2017 +0100
+++ b/mercurial/templates/paper/manifest.tmpl	Wed Nov 15 23:55:09 2017 +0800
@@ -32,7 +32,7 @@
 <h2 class="breadcrumb"><a href="/">Mercurial</a> {pathdef%breadcrumb}</h2>
 <h3>
  directory {path|escape} @ {rev}:<a href="{url|urlescape}rev/{node|short}{sessionvars%urlparameter}">{node|short}</a>
- {branch%changelogbranchname}{tags%changelogtag}{bookmarks%changelogtag}
+ {alltags}
 </h3>
 
 {searchform}
--- a/mercurial/templates/paper/map	Fri Nov 03 21:01:20 2017 +0100
+++ b/mercurial/templates/paper/map	Wed Nov 15 23:55:09 2017 +0800
@@ -203,6 +203,7 @@
 changesetbookmark = '<span class="tag">{bookmark|escape}</span> '
 changelogbranchhead = '<span class="branchhead">{name|escape}</span> '
 changelogbranchname = '<span class="branchname">{name|escape}</span> '
+alltags = '{inbranch%changelogbranchname}{branches%changelogbranchhead}{tags%changelogtag}{bookmarks%changelogtag}'
 
 filediffparent = '
   <tr>
--- a/mercurial/templates/paper/shortlogentry.tmpl	Fri Nov 03 21:01:20 2017 +0100
+++ b/mercurial/templates/paper/shortlogentry.tmpl	Wed Nov 15 23:55:09 2017 +0800
@@ -3,6 +3,6 @@
   <td class="author">{author|person}</td>
   <td class="description">
    <a href="{url|urlescape}rev/{node|short}{sessionvars%urlparameter}">{desc|strip|firstline|escape|nonempty}</a>
-   {inbranch%changelogbranchname}{branches%changelogbranchhead}{tags%changelogtag}{bookmarks%changelogtag}
+   {alltags}
   </td>
  </tr>
--- a/tests/test-hgweb-commands.t	Fri Nov 03 21:01:20 2017 +0100
+++ b/tests/test-hgweb-commands.t	Wed Nov 15 23:55:09 2017 +0800
@@ -1312,7 +1312,7 @@
   <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
   <h3>
    view foo @ 1:<a href="/rev/a4f92ed23982">a4f92ed23982</a>
-   
+   <span class="branchhead">default</span> 
   </h3>
   
   
@@ -1446,7 +1446,7 @@
   <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
   <h3>
    view foo @ 2:<a href="/rev/1d22e65f027e">1d22e65f027e</a>
-   <span class="branchname">stable</span> 
+   <span class="branchhead">stable</span> 
   </h3>
   
   
--- a/tests/test-hgweb-descend-empties.t	Fri Nov 03 21:01:20 2017 +0100
+++ b/tests/test-hgweb-descend-empties.t	Wed Nov 15 23:55:09 2017 +0800
@@ -73,7 +73,7 @@
   <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
   <h3>
    directory / @ 0:<a href="/rev/c9f45f7a1659">c9f45f7a1659</a>
-   <span class="tag">tip</span> 
+   <span class="branchhead">default</span> <span class="tag">tip</span> 
   </h3>
   
   
@@ -193,7 +193,7 @@
   <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
   <h3>
    directory / @ 0:<a href="/rev/c9f45f7a1659?style=coal">c9f45f7a1659</a>
-   <span class="tag">tip</span> 
+   <span class="branchhead">default</span> <span class="tag">tip</span> 
   </h3>
   
   
--- a/tests/test-hgweb-diffs.t	Fri Nov 03 21:01:20 2017 +0100
+++ b/tests/test-hgweb-diffs.t	Wed Nov 15 23:55:09 2017 +0800
@@ -254,7 +254,7 @@
   <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
   <h3>
    diff b @ 1:<a href="/rev/559edbd9ed20">559edbd9ed20</a>
-   <span class="tag">tip</span> 
+   <span class="branchhead">default</span> <span class="tag">tip</span> 
   </h3>
   
   
@@ -536,7 +536,7 @@
   <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
   <h3>
    diff a @ 1:<a href="/rev/559edbd9ed20">559edbd9ed20</a>
-   <span class="tag">tip</span> 
+   <span class="branchhead">default</span> <span class="tag">tip</span> 
   </h3>
   
   
@@ -772,7 +772,7 @@
   <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
   <h3>
    comparison a @ 2:<a href="/rev/d73db4d812ff">d73db4d812ff</a>
-   <span class="tag">tip</span> 
+   <span class="branchhead">default</span> <span class="tag">tip</span> 
   </h3>
   
   
@@ -904,7 +904,7 @@
   <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
   <h3>
    comparison a @ 3:<a href="/rev/20e80271eb7a">20e80271eb7a</a>
-   <span class="tag">tip</span> 
+   <span class="branchhead">default</span> <span class="tag">tip</span> 
   </h3>
   
   
@@ -1042,7 +1042,7 @@
   <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
   <h3>
    comparison e @ 5:<a href="/rev/41d9fc4a6ae1">41d9fc4a6ae1</a>
-   <span class="tag">tip</span> 
+   <span class="branchhead">default</span> <span class="tag">tip</span> 
   </h3>
   
   
--- a/tests/test-hgweb-filelog.t	Fri Nov 03 21:01:20 2017 +0100
+++ b/tests/test-hgweb-filelog.t	Wed Nov 15 23:55:09 2017 +0800
@@ -740,7 +740,7 @@
   <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
   <h3>
    log c @ 7:<a href="/rev/46c1a66bd8fc">46c1a66bd8fc</a>
-   <span class="branchname">a-branch</span> <span class="tag">tip</span> 
+   <span class="branchhead">a-branch</span> <span class="tag">tip</span> 
     (following lines 1:2 <a href="/log/tip/c">back to filelog</a>)
   </h3>
   
@@ -860,7 +860,7 @@
   <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
   <h3>
    log c @ 7:<a href="/rev/46c1a66bd8fc?revcount=1">46c1a66bd8fc</a>
-   <span class="branchname">a-branch</span> <span class="tag">tip</span> 
+   <span class="branchhead">a-branch</span> <span class="tag">tip</span> 
     (following lines 1:2 <a href="/log/tip/c?revcount=1">back to filelog</a>)
   </h3>
   
@@ -1379,7 +1379,7 @@
   <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
   <h3>
    log c @ 12:<a href="/rev/6e4182052f7b">6e4182052f7b</a>
-   <span class="branchname">a-branch</span> <span class="tag">tip</span> 
+   <span class="branchhead">a-branch</span> <span class="tag">tip</span> 
     (following lines 3:4 <a href="/log/tip/c">back to filelog</a>)
   </h3>
   
--- a/tests/test-hgweb-removed.t	Fri Nov 03 21:01:20 2017 +0100
+++ b/tests/test-hgweb-removed.t	Wed Nov 15 23:55:09 2017 +0800
@@ -62,7 +62,7 @@
   <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
   <h3>
    changeset 1:<a href="/rev/c78f6c5cbea9">c78f6c5cbea9</a>
-   <span class="tag">tip</span> 
+   <span class="branchhead">default</span> <span class="tag">tip</span> 
   </h3>
   
   
@@ -190,7 +190,7 @@
   <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
   <h3>
    diff a @ 1:<a href="/rev/c78f6c5cbea9">c78f6c5cbea9</a>
-   <span class="tag">tip</span> 
+   <span class="branchhead">default</span> <span class="tag">tip</span> 
   </h3>
   
   
--- a/tests/test-hgweb.t	Fri Nov 03 21:01:20 2017 +0100
+++ b/tests/test-hgweb.t	Wed Nov 15 23:55:09 2017 +0800
@@ -267,7 +267,7 @@
   <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
   <h3>
    directory / @ 0:<a href="/rev/2ef0ac749a14">2ef0ac749a14</a>
-   <span class="tag">tip</span> <span class="tag">@</span> <span class="tag">a b c</span> <span class="tag">d/e/f</span> 
+   <span class="branchhead">default</span> <span class="tag">tip</span> <span class="tag">@</span> <span class="tag">a b c</span> <span class="tag">d/e/f</span> 
   </h3>
   
   
--- a/tests/test-highlight.t	Fri Nov 03 21:01:20 2017 +0100
+++ b/tests/test-highlight.t	Wed Nov 15 23:55:09 2017 +0800
@@ -113,7 +113,7 @@
   <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
   <h3>
    view primes.py @ 0:<a href="/rev/f4fca47b67e6">f4fca47b67e6</a>
-   <span class="tag">tip</span> 
+   <span class="branchhead">default</span> <span class="tag">tip</span> 
   </h3>
   
   
@@ -252,7 +252,7 @@
   <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
   <h3>
    annotate primes.py @ 0:<a href="/rev/f4fca47b67e6">f4fca47b67e6</a>
-   <span class="tag">tip</span> 
+   <span class="branchhead">default</span> <span class="tag">tip</span> 
   </h3>