Patchwork [2,of,2] hgweb: move changeset "tags" to a template in map file (gitweb and monoblue)

login
register
mail settings
Submitter Anton Shestakov
Date Nov. 15, 2017, 12:05 p.m.
Message ID <4a66b5969fd89cfec836.1510747507@neuro>
Download mbox | patch
Permalink /patch/25576/
State Accepted
Headers show

Comments

Anton Shestakov - Nov. 15, 2017, 12:05 p.m.
# HG changeset patch
# User Anton Shestakov <av6@dwimlabs.net>
# Date 1510745776 -28800
#      Wed Nov 15 19:36:16 2017 +0800
# Node ID 4a66b5969fd89cfec836b398aa3a7c3d4d827ed6
# Parent  863decb0e33c8b4824a45708e5d1ad533f086529
# EXP-Topic hgweb-cleanup
hgweb: move changeset "tags" to a template in map file (gitweb and monoblue)

Less duplication and it's also easier to add extra "tags" everywhere at once.

These aren't tags as defined `hg help glossary` (hence the quotes), they are
simply called that. They include branch name (in different styles if changeset
is a head of that branch or not), (actual) tags and bookmarks. Good candidates
to add to this list would be changeset phase and obsoletion status.

Patch

diff --git a/mercurial/templates/gitweb/changelogentry.tmpl b/mercurial/templates/gitweb/changelogentry.tmpl
--- a/mercurial/templates/gitweb/changelogentry.tmpl
+++ b/mercurial/templates/gitweb/changelogentry.tmpl
@@ -2,7 +2,7 @@ 
  <a class="title" href="{url|urlescape}rev/{node|short}{sessionvars%urlparameter}">
   <span class="age">{date|rfc822date}</span>
   {desc|strip|firstline|escape|nonempty}
-  <span class="logtags">{inbranch%inbranchtag}{branches%branchtag}{tags%tagtag}{bookmarks%bookmarktag}</span>
+  {alltags}
  </a>
 </div>
 <div class="title_text">
diff --git a/mercurial/templates/gitweb/changeset.tmpl b/mercurial/templates/gitweb/changeset.tmpl
--- a/mercurial/templates/gitweb/changeset.tmpl
+++ b/mercurial/templates/gitweb/changeset.tmpl
@@ -32,7 +32,7 @@  changeset |
 <div>
  <a class="title" href="{url|urlescape}raw-rev/{node|short}">
   {desc|strip|escape|firstline|nonempty}
-  <span class="logtags">{inbranch%inbranchtag}{branches%branchtag}{tags%tagtag}{bookmarks%bookmarktag}</span>
+  {alltags}
  </a>
 </div>
 <div class="title_text">
diff --git a/mercurial/templates/gitweb/manifest.tmpl b/mercurial/templates/gitweb/manifest.tmpl
--- a/mercurial/templates/gitweb/manifest.tmpl
+++ b/mercurial/templates/gitweb/manifest.tmpl
@@ -28,7 +28,7 @@  files |
 {searchform}
 </div>
 
-<div class="title">{path|escape} <span class="logtags">{inbranch%inbranchtag}{branches%branchtag}{tags%tagtag}{bookmarks%bookmarktag}</span></div>
+<div class="title">{path|escape} {alltags}</div>
 <table cellspacing="0">
 <tr class="parity{upparity}">
 <td style="font-family:monospace">drwxr-xr-x</td>
diff --git a/mercurial/templates/gitweb/map b/mercurial/templates/gitweb/map
--- a/mercurial/templates/gitweb/map
+++ b/mercurial/templates/gitweb/map
@@ -266,6 +266,7 @@  tagtag = '<span class="tagtag" title="{n
 branchtag = '<span class="branchtag" title="{name|escape}">{name|escape}</span> '
 inbranchtag = '<span class="inbranchtag" title="{name|escape}">{name|escape}</span> '
 bookmarktag = '<span class="bookmarktag" title="{name|escape}">{name|escape}</span> '
+alltags = '<span class="logtags">{inbranch%inbranchtag}{branches%branchtag}{tags%tagtag}{bookmarks%bookmarktag}</span>'
 shortlogentry = '
   <tr class="parity{parity}">
     <td class="age"><i class="age">{date|rfc822date}</i></td>
@@ -273,7 +274,7 @@  shortlogentry = '
     <td>
       <a class="list" href="{url|urlescape}rev/{node|short}{sessionvars%urlparameter}">
         <b>{desc|strip|firstline|escape|nonempty}</b>
-        <span class="logtags">{inbranch%inbranchtag}{branches%branchtag}{tags%tagtag}{bookmarks%bookmarktag}</span>
+        {alltags}
       </a>
     </td>
     <td class="link" nowrap>
@@ -288,7 +289,7 @@  filelogentry = '
     <td>
       <a class="list" href="{url|urlescape}rev/{node|short}{sessionvars%urlparameter}">
         <b>{desc|strip|firstline|escape|nonempty}</b>
-        <span class="logtags">{inbranch%inbranchtag}{branches%branchtag}{tags%tagtag}{bookmarks%bookmarktag}</span>
+        {alltags}
       </a>
     </td>
     <td class="link">
diff --git a/mercurial/templates/monoblue/changelogentry.tmpl b/mercurial/templates/monoblue/changelogentry.tmpl
--- a/mercurial/templates/monoblue/changelogentry.tmpl
+++ b/mercurial/templates/monoblue/changelogentry.tmpl
@@ -1,7 +1,7 @@ 
 <h3 class="changelog">
     <a class="title" href="{url|urlescape}rev/{node|short}{sessionvars%urlparameter}">
         {desc|strip|firstline|escape|nonempty}
-        <span class="logtags">{inbranch%inbranchtag}{branches%branchtag}{tags%tagtag}{bookmarks%bookmarktag}</span>
+        {alltags}
     </a>
 </h3>
 <ul class="changelog-entry">
diff --git a/mercurial/templates/monoblue/changeset.tmpl b/mercurial/templates/monoblue/changeset.tmpl
--- a/mercurial/templates/monoblue/changeset.tmpl
+++ b/mercurial/templates/monoblue/changeset.tmpl
@@ -35,7 +35,7 @@ 
     <h3 class="changeset">
         <a href="{url|urlescape}raw-rev/{node|short}">
             {desc|strip|escape|firstline|nonempty}
-            <span class="logtags">{inbranch%inbranchtag}{branches%branchtag}{tags%tagtag}{bookmarks%bookmarktag}</span>
+            {alltags}
         </a>
     </h3>
     <p class="changeset-age"><span class="age">{date|rfc822date}</span></p>
diff --git a/mercurial/templates/monoblue/manifest.tmpl b/mercurial/templates/monoblue/manifest.tmpl
--- a/mercurial/templates/monoblue/manifest.tmpl
+++ b/mercurial/templates/monoblue/manifest.tmpl
@@ -30,7 +30,7 @@ 
     </ul>
 
     <h2 class="no-link no-border">files</h2>
-    <p class="files">{path|escape} <span class="logtags">{inbranch%inbranchtag}{branches%branchtag}{tags%tagtag}{bookmarks%bookmarktag}</span></p>
+    <p class="files">{path|escape} {alltags}</p>
 
     <table>
         <tr class="parity{upparity}">
diff --git a/mercurial/templates/monoblue/map b/mercurial/templates/monoblue/map
--- a/mercurial/templates/monoblue/map
+++ b/mercurial/templates/monoblue/map
@@ -225,6 +225,7 @@  tagtag = '<span class="tagtag" title="{n
 branchtag = '<span class="branchtag" title="{name|escape}">{name|escape}</span> '
 inbranchtag = '<span class="inbranchtag" title="{name|escape}">{name|escape}</span> '
 bookmarktag = '<span class="bookmarktag" title="{name|escape}">{name|escape}</span> '
+alltags = '<span class="logtags">{inbranch%inbranchtag}{branches%branchtag}{tags%tagtag}{bookmarks%bookmarktag}</span>'
 shortlogentry = '
   <tr class="parity{parity}">
     <td class="nowrap age">{date|rfc822date}</td>
@@ -232,7 +233,7 @@  shortlogentry = '
     <td>
       <a href="{url|urlescape}rev/{node|short}{sessionvars%urlparameter}">
         {desc|strip|firstline|escape|nonempty}
-        <span class="logtags">{inbranch%inbranchtag}{branches%branchtag}{tags%tagtag}{bookmarks%bookmarktag}</span>
+        {alltags}
       </a>
     </td>
     <td class="nowrap">
@@ -247,7 +248,7 @@  filelogentry = '
     <td>
       <a href="{url|urlescape}rev/{node|short}{sessionvars%urlparameter}">
         {desc|strip|firstline|escape|nonempty}
-        <span class="logtags">{inbranch%inbranchtag}{branches%branchtag}{tags%tagtag}{bookmarks%bookmarktag}</span>
+        {alltags}
       </a>
     </td>
     <td class="nowrap">