hgweb: show dates recorded in obsolescence markers
Dates of operations that obsolete commits are also important enough to be
shown, but maybe not as important as original commit dates, that and also for
brevity is why they are wrapped in a <span> with only "age" class. Provided
that JS is enabled, such elements only show age (e.g. "3 months ago"), and the
exact date is visible in a tooltip. Commits dates, on the other hand, show both
date and age (the latter in parenthesis).
Example result for
f1a0933ce59e from hg-committed:
obsolete: pruned by Yuya Nishihara <yuya@tcha.org> 13 days ago
--- a/mercurial/templates/gitweb/map Thu Feb 15 21:05:31 2018 +0800
+++ b/mercurial/templates/gitweb/map Thu Feb 15 21:14:57 2018 +0800
@@ -276,7 +276,8 @@
obsfateverb = '{obsfateverb(successors, markers)}'
obsfateoperations = '{if(obsfateoperations(markers), ' using {join(obsfateoperations(markers), ', ')}')}'
obsfateusers = '{if(obsfateusers(markers), ' by {join(obsfateusers(markers)%'{user|obfuscate}', ', ')}')}'
-obsfateentry = '{obsfateverb}{obsfateoperations}{obsfatesuccessors}{obsfateusers}'
+obsfatedate = '{if(obsfatedate(markers), ' {ifeq(min(obsfatedate(markers)), max(obsfatedate(markers)), '<span class="age">{min(obsfatedate(markers))|rfc822date}</span>', 'between <span class="age">{min(obsfatedate(markers))|rfc822date}</span> and <span class="age">{max(obsfatedate(markers))|rfc822date}</span>')}')}'
+obsfateentry = '{obsfateverb}{obsfateoperations}{obsfatesuccessors}{obsfateusers}{obsfatedate}'
shortlogentry = '
<tr class="parity{parity}">
<td class="age"><i class="age">{date|rfc822date}</i></td>
--- a/mercurial/templates/monoblue/map Thu Feb 15 21:05:31 2018 +0800
+++ b/mercurial/templates/monoblue/map Thu Feb 15 21:14:57 2018 +0800
@@ -234,7 +234,8 @@
obsfateverb = '{obsfateverb(successors, markers)}'
obsfateoperations = '{if(obsfateoperations(markers), ' using {join(obsfateoperations(markers), ', ')}')}'
obsfateusers = '{if(obsfateusers(markers), ' by {join(obsfateusers(markers)%'{user|obfuscate}', ', ')}')}'
-obsfateentry = '{obsfateverb}{obsfateoperations}{obsfatesuccessors}{obsfateusers}'
+obsfatedate = '{if(obsfatedate(markers), ' {ifeq(min(obsfatedate(markers)), max(obsfatedate(markers)), '<span class="age">{min(obsfatedate(markers))|rfc822date}</span>', 'between <span class="age">{min(obsfatedate(markers))|rfc822date}</span> and <span class="age">{max(obsfatedate(markers))|rfc822date}</span>')}')}'
+obsfateentry = '{obsfateverb}{obsfateoperations}{obsfatesuccessors}{obsfateusers}{obsfatedate}'
shortlogentry = '
<tr class="parity{parity}">
<td class="nowrap age">{date|rfc822date}</td>
--- a/mercurial/templates/paper/map Thu Feb 15 21:05:31 2018 +0800
+++ b/mercurial/templates/paper/map Thu Feb 15 21:14:57 2018 +0800
@@ -214,7 +214,8 @@
obsfateverb = '{obsfateverb(successors, markers)}'
obsfateoperations = '{if(obsfateoperations(markers), ' using {join(obsfateoperations(markers), ', ')}')}'
obsfateusers = '{if(obsfateusers(markers), ' by {join(obsfateusers(markers)%'{user|obfuscate}', ', ')}')}'
-obsfateentry = '{obsfateverb}{obsfateoperations}{obsfatesuccessors}{obsfateusers}'
+obsfatedate = '{if(obsfatedate(markers), ' {ifeq(min(obsfatedate(markers)), max(obsfatedate(markers)), '<span class="age">{min(obsfatedate(markers))|rfc822date}</span>', 'between <span class="age">{min(obsfatedate(markers))|rfc822date}</span> and <span class="age">{max(obsfatedate(markers))|rfc822date}</span>')}')}'
+obsfateentry = '{obsfateverb}{obsfateoperations}{obsfatesuccessors}{obsfateusers}{obsfatedate}'
filediffparent = '
<tr>
--- a/mercurial/templates/spartan/map Thu Feb 15 21:05:31 2018 +0800
+++ b/mercurial/templates/spartan/map Thu Feb 15 21:14:57 2018 +0800
@@ -171,7 +171,8 @@
obsfateverb = '{obsfateverb(successors, markers)}'
obsfateoperations = '{if(obsfateoperations(markers), ' using {join(obsfateoperations(markers), ', ')}')}'
obsfateusers = '{if(obsfateusers(markers), ' by {join(obsfateusers(markers)%'{user|obfuscate}', ', ')}')}'
-obsfateentry = '{obsfateverb}{obsfateoperations}{obsfatesuccessors}{obsfateusers}'
+obsfatedate = '{if(obsfatedate(markers), ' {ifeq(min(obsfatedate(markers)), max(obsfatedate(markers)), '<span class="age">{min(obsfatedate(markers))|rfc822date}</span>', 'between <span class="age">{min(obsfatedate(markers))|rfc822date}</span> and <span class="age">{max(obsfatedate(markers))|rfc822date}</span>')}')}'
+obsfateentry = '{obsfateverb}{obsfateoperations}{obsfatesuccessors}{obsfateusers}{obsfatedate}'
filediffparent = '
<tr>
<th class="parent">parent {rev}:</th>
--- a/tests/test-obsolete.t Thu Feb 15 21:05:31 2018 +0800
+++ b/tests/test-obsolete.t Thu Feb 15 21:14:57 2018 +0800
@@ -1050,19 +1050,19 @@
<span class="logtags"><span class="phasetag" title="draft">draft</span> <span class="obsoletetag" title="obsolete">obsolete</span> </span>
$ get-with-headers.py localhost:$HGPORT 'log?rev=first(obsolete())&style=spartan' | grep 'class="obsolete"'
<th class="obsolete">obsolete:</th>
- <td class="obsolete">pruned by test</td>
+ <td class="obsolete">pruned by test <span class="age">Thu, 01 Jan 1970 00:00:00 +0000</span></td>
check an obsolete changeset that has been rewritten
$ get-with-headers.py localhost:$HGPORT 'rev/cda648ca50f5?style=paper' | grep rewritten
- <td>rewritten as <a href="/rev/3de5eca88c00?style=paper">3de5eca88c00</a> by test <test@example.net></td>
+ <td>rewritten as <a href="/rev/3de5eca88c00?style=paper">3de5eca88c00</a> by test <test@example.net> <span class="age">Thu, 01 Jan 1970 00:00:00 +0000</span></td>
$ get-with-headers.py localhost:$HGPORT 'rev/cda648ca50f5?style=coal' | grep rewritten
- <td>rewritten as <a href="/rev/3de5eca88c00?style=coal">3de5eca88c00</a> by test <test@example.net></td>
+ <td>rewritten as <a href="/rev/3de5eca88c00?style=coal">3de5eca88c00</a> by test <test@example.net> <span class="age">Thu, 01 Jan 1970 00:00:00 +0000</span></td>
$ get-with-headers.py localhost:$HGPORT 'rev/cda648ca50f5?style=gitweb' | grep rewritten
- <tr><td>obsolete</td><td>rewritten as <a class="list" href="/rev/3de5eca88c00?style=gitweb">3de5eca88c00</a> by test <test@example.net></td></tr>
+ <tr><td>obsolete</td><td>rewritten as <a class="list" href="/rev/3de5eca88c00?style=gitweb">3de5eca88c00</a> by test <test@example.net> <span class="age">Thu, 01 Jan 1970 00:00:00 +0000</span></td></tr>
$ get-with-headers.py localhost:$HGPORT 'rev/cda648ca50f5?style=monoblue' | grep rewritten
- <dt>obsolete</dt><dd>rewritten as <a href="/rev/3de5eca88c00?style=monoblue">3de5eca88c00</a> by test <test@example.net></dd>
+ <dt>obsolete</dt><dd>rewritten as <a href="/rev/3de5eca88c00?style=monoblue">3de5eca88c00</a> by test <test@example.net> <span class="age">Thu, 01 Jan 1970 00:00:00 +0000</span></dd>
$ get-with-headers.py localhost:$HGPORT 'rev/cda648ca50f5?style=spartan' | grep rewritten
- <td class="obsolete">rewritten as <a href="/rev/3de5eca88c00?style=spartan">3de5eca88c00</a> by test <test@example.net></td>
+ <td class="obsolete">rewritten as <a href="/rev/3de5eca88c00?style=spartan">3de5eca88c00</a> by test <test@example.net> <span class="age">Thu, 01 Jan 1970 00:00:00 +0000</span></td>
check changeset with instabilities