changeset 9721:1d75c683ada1

templater: put 'ago' inside the age template filter
author Dirkjan Ochtman <dirkjan@ochtman.nl>
date Thu, 05 Nov 2009 14:44:29 +0100
parents bb00a159e594
children 4d9dea174b84
files mercurial/templatefilters.py templates/gitweb/changelogentry.tmpl templates/gitweb/changeset.tmpl templates/gitweb/fileannotate.tmpl templates/gitweb/filerevision.tmpl templates/gitweb/map templates/monoblue/changelogentry.tmpl templates/monoblue/changeset.tmpl templates/monoblue/fileannotate.tmpl templates/monoblue/filerevision.tmpl templates/monoblue/map templates/paper/changeset.tmpl templates/paper/fileannotate.tmpl templates/paper/filediff.tmpl templates/paper/filerevision.tmpl templates/paper/map templates/spartan/changelogentry.tmpl templates/spartan/changeset.tmpl templates/spartan/fileannotate.tmpl templates/spartan/filelogentry.tmpl templates/spartan/filerevision.tmpl templates/static/style-paper.css tests/test-hgweb-commands.out tests/test-hgweb-filelog.out
diffstat 24 files changed, 40 insertions(+), 40 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/templatefilters.py	Thu Nov 05 14:26:37 2009 +0100
+++ b/mercurial/templatefilters.py	Thu Nov 05 14:44:29 2009 +0100
@@ -43,7 +43,7 @@
     for t, s in agescales:
         n = delta // s
         if n >= 2 or s == 1:
-            return fmt(t, n)
+            return '%s ago' % fmt(t, n)
 
 para_re = None
 space_re = None
--- a/templates/gitweb/changelogentry.tmpl	Thu Nov 05 14:26:37 2009 +0100
+++ b/templates/gitweb/changelogentry.tmpl	Thu Nov 05 14:44:29 2009 +0100
@@ -1,5 +1,5 @@
 <div>
-<a class="title" href="{url}rev/{node|short}{sessionvars%urlparameter}"><span class="age">{date|age} ago</span>{desc|strip|firstline|escape|nonempty}<span class="logtags"> {inbranch%inbranchtag}{branches%branchtag}{tags%tagtag}</span></a>
+<a class="title" href="{url}rev/{node|short}{sessionvars%urlparameter}"><span class="age">{date|age}</span>{desc|strip|firstline|escape|nonempty}<span class="logtags"> {inbranch%inbranchtag}{branches%branchtag}{tags%tagtag}</span></a>
 </div>
 <div class="title_text">
 <div class="log_link">
--- a/templates/gitweb/changeset.tmpl	Thu Nov 05 14:26:37 2009 +0100
+++ b/templates/gitweb/changeset.tmpl	Thu Nov 05 14:44:29 2009 +0100
@@ -29,7 +29,7 @@
 <div class="title_text">
 <table cellspacing="0">
 <tr><td>author</td><td>{author|obfuscate}</td></tr>
-<tr><td></td><td>{date|date} ({date|age} ago)</td></tr>
+<tr><td></td><td>{date|date} ({date|age})</td></tr>
 {branch%changesetbranch}
 <tr><td>changeset {rev}</td><td style="font-family:monospace">{node|short}</td></tr>
 {parent%changesetparent}
--- a/templates/gitweb/fileannotate.tmpl	Thu Nov 05 14:26:37 2009 +0100
+++ b/templates/gitweb/fileannotate.tmpl	Thu Nov 05 14:44:29 2009 +0100
@@ -36,7 +36,7 @@
  <td>{author|obfuscate}</td></tr>
 <tr>
  <td></td>
- <td>{date|date} ({date|age} ago)</td></tr>
+ <td>{date|date} ({date|age})</td></tr>
 {branch%filerevbranch}
 <tr>
  <td>changeset {rev}</td>
--- a/templates/gitweb/filerevision.tmpl	Thu Nov 05 14:26:37 2009 +0100
+++ b/templates/gitweb/filerevision.tmpl	Thu Nov 05 14:44:29 2009 +0100
@@ -36,7 +36,7 @@
  <td>{author|obfuscate}</td></tr>
 <tr>
  <td></td>
- <td>{date|date} ({date|age} ago)</td></tr>
+ <td>{date|date} ({date|age})</td></tr>
 {branch%filerevbranch}
 <tr>
  <td>changeset {rev}</td>
--- a/templates/gitweb/map	Thu Nov 05 14:26:37 2009 +0100
+++ b/templates/gitweb/map	Thu Nov 05 14:44:29 2009 +0100
@@ -150,7 +150,7 @@
 tags = tags.tmpl
 tagentry = '
   <tr class="parity{parity}">
-    <td class="age"><i>{date|age} ago</i></td>
+    <td class="age"><i>{date|age}</i></td>
     <td><a class="list" href="{url}rev/{node|short}{sessionvars%urlparameter}"><b>{tag|escape}</b></a></td>
     <td class="link">
       <a href="{url}rev/{node|short}{sessionvars%urlparameter}">changeset</a> |
@@ -161,7 +161,7 @@
 branches = branches.tmpl
 branchentry = '
   <tr class="parity{parity}">
-    <td class="age"><i>{date|age} ago</i></td>
+    <td class="age"><i>{date|age}</i></td>
     <td><a class="list" href="{url}shortlog/{node|short}{sessionvars%urlparameter}"><b>{node|short}</b></a></td>
     <td class="{status}">{branch|escape}</td>
     <td class="link">
@@ -204,7 +204,7 @@
 inbranchtag = '<span class="inbranchtag" title="{name}">{name}</span> '
 shortlogentry = '
   <tr class="parity{parity}">
-    <td class="age"><i>{date|age} ago</i></td>
+    <td class="age"><i>{date|age}</i></td>
     <td><i>{author|person}</i></td>
     <td>
       <a class="list" href="{url}rev/{node|short}{sessionvars%urlparameter}">
@@ -219,7 +219,7 @@
   </tr>'
 filelogentry = '
   <tr class="parity{parity}">
-    <td class="age"><i>{date|age} ago</i></td>
+    <td class="age"><i>{date|age}</i></td>
     <td>
       <a class="list" href="{url}rev/{node|short}{sessionvars%urlparameter}">
         <b>{desc|strip|firstline|escape|nonempty}</b>
@@ -238,7 +238,7 @@
     </td>
     <td>{description}</td>
     <td>{contact|obfuscate}</td>
-    <td class="age">{lastchange|age} ago</td>
+    <td class="age">{lastchange|age}</td>
     <td class="indexlinks">{archives%indexarchiveentry}</td>
     <td><div class="rss_logo"><a href="{url}rss-log">RSS</a> <a href="{url}atom-log">Atom</a></div></td>
   </tr>\n'
--- a/templates/monoblue/changelogentry.tmpl	Thu Nov 05 14:26:37 2009 +0100
+++ b/templates/monoblue/changelogentry.tmpl	Thu Nov 05 14:44:29 2009 +0100
@@ -1,6 +1,6 @@
 <h3 class="changelog"><a class="title" href="{url}rev/{node|short}{sessionvars%urlparameter}">{desc|strip|firstline|escape|nonempty}<span class="logtags"> {inbranch%inbranchtag}{branches%branchtag}{tags%tagtag}</span></a></h3>
 <ul class="changelog-entry">
-    <li class="age">{date|age} ago</li>
+    <li class="age">{date|age}</li>
     <li>by <span class="name">{author|obfuscate}</span> <span class="revdate">[{date|rfc822date}] rev {rev}</span></li>
     <li class="description">{desc|strip|escape|addbreaks|nonempty}</li>
 </ul>
--- a/templates/monoblue/changeset.tmpl	Thu Nov 05 14:26:37 2009 +0100
+++ b/templates/monoblue/changeset.tmpl	Thu Nov 05 14:44:29 2009 +0100
@@ -36,7 +36,7 @@
     <h2 class="no-link no-border">changeset</h2>
 
     <h3 class="changeset"><a href="{url}raw-rev/{node|short}">{desc|strip|escape|firstline|nonempty} <span class="logtags">{inbranch%inbranchtag}{branches%branchtag}{tags%tagtag}</span></a></h3>
-    <p class="changeset-age"><span>{date|age} ago</span></p>
+    <p class="changeset-age"><span>{date|age}</span></p>
 
     <dl class="overview">
         <dt>author</dt>
--- a/templates/monoblue/fileannotate.tmpl	Thu Nov 05 14:26:37 2009 +0100
+++ b/templates/monoblue/fileannotate.tmpl	Thu Nov 05 14:44:29 2009 +0100
@@ -38,7 +38,7 @@
 
     <h2 class="no-link no-border">{file|escape}@{node|short} (annotated)</h2>
     <h3 class="changeset">{file|escape}</h3>
-    <p class="changeset-age"><span>{date|age} ago</span></p>
+    <p class="changeset-age"><span>{date|age}</span></p>
 
     <dl class="overview">
         <dt>author</dt>
--- a/templates/monoblue/filerevision.tmpl	Thu Nov 05 14:26:37 2009 +0100
+++ b/templates/monoblue/filerevision.tmpl	Thu Nov 05 14:44:29 2009 +0100
@@ -38,7 +38,7 @@
 
     <h2 class="no-link no-border">{file|escape}@{node|short}</h2>
     <h3 class="changeset">{file|escape}</h3>
-    <p class="changeset-age"><span>{date|age} ago</span></p>
+    <p class="changeset-age"><span>{date|age}</span></p>
 
     <dl class="overview">
         <dt>author</dt>
--- a/templates/monoblue/map	Thu Nov 05 14:26:37 2009 +0100
+++ b/templates/monoblue/map	Thu Nov 05 14:44:29 2009 +0100
@@ -127,7 +127,7 @@
 tags = tags.tmpl
 tagentry = '
   <tr class="parity{parity}">
-    <td class="nowrap">{date|age} ago</td>
+    <td class="nowrap">{date|age}</td>
     <td><a href="{url}rev/{node|short}{sessionvars%urlparameter}">{tag|escape}</a></td>
     <td class="nowrap">
       <a href="{url}rev/{node|short}{sessionvars%urlparameter}">changeset</a> |
@@ -138,7 +138,7 @@
 branches = branches.tmpl
 branchentry = '
   <tr class="parity{parity}">
-    <td class="nowrap">{date|age} ago</td>
+    <td class="nowrap">{date|age}</td>
     <td><a href="{url}shortlog/{node|short}{sessionvars%urlparameter}">{node|short}</a></td>
     <td class="{status}">{branch|escape}</td>
     <td class="nowrap">
@@ -170,7 +170,7 @@
 inbranchtag = '<span class="inbranchtag" title="{name}">{name}</span> '
 shortlogentry = '
   <tr class="parity{parity}">
-    <td class="nowrap">{date|age} ago</td>
+    <td class="nowrap">{date|age}</td>
     <td>{author|person}</td>
     <td>
       <a href="{url}rev/{node|short}{sessionvars%urlparameter}">
@@ -185,7 +185,7 @@
   </tr>'
 filelogentry = '
   <tr class="parity{parity}">
-    <td class="nowrap">{date|age} ago</td>
+    <td class="nowrap">{date|age}</td>
     <td><a href="{url}rev/{node|short}{sessionvars%urlparameter}">{desc|strip|firstline|escape|nonempty}</a></td>
     <td class="nowrap">
       <a href="{url}file/{node|short}/{file|urlescape}{sessionvars%urlparameter}">file</a>&nbsp;|&nbsp;<a href="{url}diff/{node|short}/{file|urlescape}{sessionvars%urlparameter}">diff</a>&nbsp;|&nbsp;<a href="{url}annotate/{node|short}/{file|urlescape}{sessionvars%urlparameter}">annotate</a>
@@ -198,7 +198,7 @@
     <td><a href="{url}{sessionvars%urlparameter}">{name|escape}</a></td>
     <td>{description}</td>
     <td>{contact|obfuscate}</td>
-    <td>{lastchange|age} ago</td>
+    <td>{lastchange|age}</td>
     <td class="indexlinks">{archives%indexarchiveentry}</td>
     <td>
       <div class="rss_logo">
--- a/templates/paper/changeset.tmpl	Thu Nov 05 14:26:37 2009 +0100
+++ b/templates/paper/changeset.tmpl	Thu Nov 05 14:44:29 2009 +0100
@@ -45,7 +45,7 @@
 </tr>
 <tr>
  <th class="date">date</th>
- <td class="date">{date|date} ({date|age} ago)</td></tr>
+ <td class="date">{date|date} ({date|age})</td></tr>
 <tr>
  <th class="author">parents</th>
  <td class="author">{parent%changesetparent}</td>
--- a/templates/paper/fileannotate.tmpl	Thu Nov 05 14:26:37 2009 +0100
+++ b/templates/paper/fileannotate.tmpl	Thu Nov 05 14:44:29 2009 +0100
@@ -50,7 +50,7 @@
 </tr>
 <tr>
  <th class="date">date</th>
- <td class="date">{date|date} ({date|age} ago)</td>
+ <td class="date">{date|date} ({date|age})</td>
 </tr>
 <tr>
  <th class="author">parents</th>
--- a/templates/paper/filediff.tmpl	Thu Nov 05 14:26:37 2009 +0100
+++ b/templates/paper/filediff.tmpl	Thu Nov 05 14:44:29 2009 +0100
@@ -49,7 +49,7 @@
 </tr>
 <tr>
  <th>date</th>
- <td>{date|date} ({date|age} ago)</td>
+ <td>{date|date} ({date|age})</td>
 </tr>
 <tr>
  <th>parents</th>
--- a/templates/paper/filerevision.tmpl	Thu Nov 05 14:26:37 2009 +0100
+++ b/templates/paper/filerevision.tmpl	Thu Nov 05 14:44:29 2009 +0100
@@ -49,7 +49,7 @@
 </tr>
 <tr>
  <th class="date">date</th>
- <td class="date">{date|date} ({date|age} ago)</td>
+ <td class="date">{date|date} ({date|age})</td>
 </tr>
 <tr>
  <th class="author">parents</th>
--- a/templates/paper/map	Thu Nov 05 14:26:37 2009 +0100
+++ b/templates/paper/map	Thu Nov 05 14:44:29 2009 +0100
@@ -176,7 +176,7 @@
     <td><a href="{url}{sessionvars%urlparameter}">{name|escape}</a></td>
     <td>{description}</td>
     <td>{contact|obfuscate}</td>
-    <td class="age">{lastchange|age} ago</td>
+    <td class="age">{lastchange|age}</td>
     <td class="indexlinks">{archives%indexarchiveentry}</td>
   </tr>\n'
 indexarchiveentry = '<a href="{url}archive/{node|short}{extension|urlescape}">&nbsp;&darr;{type|escape}</a>'
--- a/templates/spartan/changelogentry.tmpl	Thu Nov 05 14:26:37 2009 +0100
+++ b/templates/spartan/changelogentry.tmpl	Thu Nov 05 14:44:29 2009 +0100
@@ -1,6 +1,6 @@
 <table class="logEntry parity{parity}">
  <tr>
-  <th class="age">{date|age} ago:</th>
+  <th class="age">{date|age}:</th>
   <th class="firstline">{desc|strip|firstline|escape|nonempty}</th>
  </tr>
  <tr>
--- a/templates/spartan/changeset.tmpl	Thu Nov 05 14:26:37 2009 +0100
+++ b/templates/spartan/changeset.tmpl	Thu Nov 05 14:44:29 2009 +0100
@@ -30,7 +30,7 @@
 </tr>
 <tr>
  <th class="date">date:</th>
- <td class="date">{date|date} ({date|age} ago)</td>
+ <td class="date">{date|date} ({date|age})</td>
 </tr>
 <tr>
  <th class="files">files:</th>
--- a/templates/spartan/fileannotate.tmpl	Thu Nov 05 14:26:37 2009 +0100
+++ b/templates/spartan/fileannotate.tmpl	Thu Nov 05 14:44:29 2009 +0100
@@ -29,7 +29,7 @@
  <td>{author|obfuscate}</td></tr>
 <tr>
  <td class="metatag">date:</td>
- <td>{date|date} ({date|age} ago)</td>
+ <td>{date|date} ({date|age})</td>
 </tr>
 <tr>
  <td class="metatag">permissions:</td>
--- a/templates/spartan/filelogentry.tmpl	Thu Nov 05 14:26:37 2009 +0100
+++ b/templates/spartan/filelogentry.tmpl	Thu Nov 05 14:44:29 2009 +0100
@@ -1,6 +1,6 @@
 <table class="logEntry parity{parity}">
  <tr>
-  <th class="age">{date|age} ago:</th>
+  <th class="age">{date|age}:</th>
   <th class="firstline"><a href="{url}rev/{node|short}{sessionvars%urlparameter}">{desc|strip|firstline|escape|nonempty}</a></th>
  </tr>
  <tr>
--- a/templates/spartan/filerevision.tmpl	Thu Nov 05 14:26:37 2009 +0100
+++ b/templates/spartan/filerevision.tmpl	Thu Nov 05 14:44:29 2009 +0100
@@ -29,7 +29,7 @@
  <td>{author|obfuscate}</td></tr>
 <tr>
  <td class="metatag">date:</td>
- <td>{date|date} ({date|age} ago)</td></tr>
+ <td>{date|date} ({date|age})</td></tr>
 <tr>
  <td class="metatag">permissions:</td>
  <td>{permissions|permissions}</td></tr>
--- a/templates/static/style-paper.css	Thu Nov 05 14:26:37 2009 +0100
+++ b/templates/static/style-paper.css	Thu Nov 05 14:44:29 2009 +0100
@@ -161,7 +161,7 @@
   border-bottom: 1px solid #999;
 }
 .bigtable tr { border: none; }
-.bigtable .age { width: 6em; }
+.bigtable .age { width: 7em; }
 .bigtable .author { width: 12em; }
 .bigtable .description { }
 .bigtable .node { width: 5em; font-family: monospace;}
--- a/tests/test-hgweb-commands.out	Thu Nov 05 14:26:37 2009 +0100
+++ b/tests/test-hgweb-commands.out	Thu Nov 05 14:44:29 2009 +0100
@@ -210,17 +210,17 @@
   <th class="description">description</th>
  </tr>
  <tr class="parity0">
-  <td class="age">many years</td>
+  <td class="age">many years ago</td>
   <td class="author">test</td>
   <td class="description"><a href="/rev/1d22e65f027e">branch</a><span class="branchhead">stable</span> <span class="tag">tip</span> </td>
  </tr>
  <tr class="parity1">
-  <td class="age">many years</td>
+  <td class="age">many years ago</td>
   <td class="author">test</td>
   <td class="description"><a href="/rev/a4f92ed23982">Added tag 1.0 for changeset 2ef0ac749a14</a><span class="branchhead">default</span> </td>
  </tr>
  <tr class="parity0">
-  <td class="age">many years</td>
+  <td class="age">many years ago</td>
   <td class="author">test</td>
   <td class="description"><a href="/rev/2ef0ac749a14">base</a><span class="tag">1.0</span> </td>
  </tr>
@@ -764,7 +764,7 @@
 <script>
 <!-- hide script content
 
-var data = [["1d22e65f027e", [0, 1], [[0, 0, 1]], "branch", "test", "many years", ["stable", true], ["tip"]], ["a4f92ed23982", [0, 1], [[0, 0, 1]], "Added tag 1.0 for changeset 2ef0ac749a14", "test", "many years", ["default", true], []], ["2ef0ac749a14", [0, 1], [], "base", "test", "many years", ["default", false], ["1.0"]]];
+var data = [["1d22e65f027e", [0, 1], [[0, 0, 1]], "branch", "test", "many years ago", ["stable", true], ["tip"]], ["a4f92ed23982", [0, 1], [[0, 0, 1]], "Added tag 1.0 for changeset 2ef0ac749a14", "test", "many years ago", ["default", true], []], ["2ef0ac749a14", [0, 1], [], "base", "test", "many years ago", ["default", false], ["1.0"]]];
 var graph = new Graph();
 graph.scale(39);
 
--- a/tests/test-hgweb-filelog.out	Thu Nov 05 14:26:37 2009 +0100
+++ b/tests/test-hgweb-filelog.out	Thu Nov 05 14:44:29 2009 +0100
@@ -148,12 +148,12 @@
   <th class="description">description</th>
  </tr>
  <tr class="parity0">
-  <td class="age">many years</td>
+  <td class="age">many years ago</td>
   <td class="author">test</td>
   <td class="description"><a href="/rev/01de2d66a28d">second a</a></td>
  </tr>
  <tr class="parity1">
-  <td class="age">many years</td>
+  <td class="age">many years ago</td>
   <td class="author">test</td>
   <td class="description"><a href="/rev/5ed941583260">first a</a></td>
  </tr>
@@ -231,12 +231,12 @@
   <th class="description">description</th>
  </tr>
  <tr class="parity0">
-  <td class="age">many years</td>
+  <td class="age">many years ago</td>
   <td class="author">test</td>
   <td class="description"><a href="/rev/01de2d66a28d">second a</a></td>
  </tr>
  <tr class="parity1">
-  <td class="age">many years</td>
+  <td class="age">many years ago</td>
   <td class="author">test</td>
   <td class="description"><a href="/rev/5ed941583260">first a</a></td>
  </tr>
@@ -314,7 +314,7 @@
   <th class="description">description</th>
  </tr>
  <tr class="parity0">
-  <td class="age">many years</td>
+  <td class="age">many years ago</td>
   <td class="author">test</td>
   <td class="description"><a href="/rev/5ed941583260">first a</a></td>
  </tr>
@@ -392,7 +392,7 @@
   <th class="description">description</th>
  </tr>
  <tr class="parity0">
-  <td class="age">many years</td>
+  <td class="age">many years ago</td>
   <td class="author">test</td>
   <td class="description"><a href="/rev/5ed941583260">first a</a></td>
  </tr>