Patchwork hgweb: show changeset age in more places (gitweb and monoblue)

login
register
mail settings
Submitter Anton Shestakov
Date Nov. 21, 2017, 2:44 p.m.
Message ID <e17143d2181bb77ef834.1511275470@neuro>
Download mbox | patch
Permalink /patch/25713/
State Accepted
Headers show

Comments

Anton Shestakov - Nov. 21, 2017, 2:44 p.m.
# HG changeset patch
# User Anton Shestakov <av6@dwimlabs.net>
# Date 1511267337 -28800
#      Tue Nov 21 20:28:57 2017 +0800
# Node ID e17143d2181bb77ef8346b7dfe32b894bbf9a064
# Parent  f8e398c42760482f02e6cfb6b8a1e6a752564c95
# EXP-Topic hgweb-more-info
hgweb: show changeset age in more places (gitweb and monoblue)

mercurial.js has a process_dates() function that calculates relative age for a
given date, it works for all elements with "age" css class. If those elements
also have "date" css class, the original text is preserved and age is added at
the end.

This patch adds these two css classes in some pages in gitweb and monoblue that
weren't already using this feature.
Yuya Nishihara - Nov. 26, 2017, 10:53 a.m.
On Tue, 21 Nov 2017 22:44:30 +0800, Anton Shestakov wrote:
> # HG changeset patch
> # User Anton Shestakov <av6@dwimlabs.net>
> # Date 1511267337 -28800
> #      Tue Nov 21 20:28:57 2017 +0800
> # Node ID e17143d2181bb77ef8346b7dfe32b894bbf9a064
> # Parent  f8e398c42760482f02e6cfb6b8a1e6a752564c95
> # EXP-Topic hgweb-more-info
> hgweb: show changeset age in more places (gitweb and monoblue)

Queued, thanks.

Patch

diff --git a/mercurial/templates/gitweb/summary.tmpl b/mercurial/templates/gitweb/summary.tmpl
--- a/mercurial/templates/gitweb/summary.tmpl
+++ b/mercurial/templates/gitweb/summary.tmpl
@@ -31,7 +31,7 @@  summary |
 <table cellspacing="0">
 <tr><td>description</td><td>{desc}</td></tr>
 <tr><td>owner</td><td>{owner|obfuscate}</td></tr>
-<tr><td>last change</td><td>{lastchange|rfc822date}</td></tr>
+<tr><td>last change</td><td class="date age">{lastchange|rfc822date}</td></tr>
 </table>
 
 <div><a  class="title" href="{url|urlescape}shortlog{sessionvars%urlparameter}">changes</a></div>
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
@@ -44,7 +44,7 @@ 
         <dt>author</dt>
         <dd>{author|obfuscate}</dd>
         <dt>date</dt>
-        <dd>{date|rfc822date}</dd>
+        <dd class="date age">{date|rfc822date}</dd>
         {branch%changesetbranch}
         <dt>changeset {rev}</dt>
         <dd><a href="{url|urlescape}rev/{node|short}{sessionvars%urlparameter}">{node|short}</a></dd>
diff --git a/mercurial/templates/monoblue/fileannotate.tmpl b/mercurial/templates/monoblue/fileannotate.tmpl
--- a/mercurial/templates/monoblue/fileannotate.tmpl
+++ b/mercurial/templates/monoblue/fileannotate.tmpl
@@ -42,7 +42,7 @@ 
         <dt>author</dt>
         <dd>{author|obfuscate}</dd>
         <dt>date</dt>
-        <dd>{date|rfc822date}</dd>
+        <dd class="date age">{date|rfc822date}</dd>
         {branch%filerevbranch}
         <dt>changeset {rev}</dt>
         <dd><a href="{url|urlescape}rev/{node|short}{sessionvars%urlparameter}">{node|short}</a></dd>
diff --git a/mercurial/templates/monoblue/filerevision.tmpl b/mercurial/templates/monoblue/filerevision.tmpl
--- a/mercurial/templates/monoblue/filerevision.tmpl
+++ b/mercurial/templates/monoblue/filerevision.tmpl
@@ -42,7 +42,7 @@ 
         <dt>author</dt>
         <dd>{author|obfuscate}</dd>
         <dt>date</dt>
-        <dd>{date|rfc822date}</dd>
+        <dd class="date age">{date|rfc822date}</dd>
         {branch%filerevbranch}
         <dt>changeset {rev}</dt>
         <dd><a class="list" href="{url|urlescape}rev/{node|short}{sessionvars%urlparameter}">{node|short}</a></dd>
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
@@ -34,7 +34,7 @@ 
         <dt>owner</dt>
         <dd>{owner|obfuscate}</dd>
         <dt>last change</dt>
-        <dd>{lastchange|rfc822date}</dd>
+        <dd class="date age">{lastchange|rfc822date}</dd>
     </dl>
 
     <h2><a href="{url|urlescape}shortlog{sessionvars%urlparameter}">Changes</a></h2>
diff --git a/tests/test-hgweb-commands.t b/tests/test-hgweb-commands.t
--- a/tests/test-hgweb-commands.t
+++ b/tests/test-hgweb-commands.t
@@ -1573,7 +1573,7 @@  Overviews
   <table cellspacing="0">
   <tr><td>description</td><td>unknown</td></tr>
   <tr><td>owner</td><td>&#70;&#111;&#111;&#32;&#66;&#97;&#114;&#32;&#60;&#102;&#111;&#111;&#46;&#98;&#97;&#114;&#64;&#101;&#120;&#97;&#109;&#112;&#108;&#101;&#46;&#99;&#111;&#109;&#62;</td></tr>
-  <tr><td>last change</td><td>Thu, 01 Jan 1970 00:00:00 +0000</td></tr>
+  <tr><td>last change</td><td class="date age">Thu, 01 Jan 1970 00:00:00 +0000</td></tr>
   </table>
   
   <div><a  class="title" href="/shortlog?style=gitweb">changes</a></div>