# HG changeset patch # User Dirkjan Ochtman # Date 2009-11-05 14:19:54 # Node ID 4d9dea174b84bb661abab6b04aef7f51c208e0a7 # Parent 1d75c683ada10bd8eac62e7f29cff1f3380a83fa templater: readable dates older than 24 months revert to ISO8601 (issue1006) diff --git a/mercurial/templatefilters.py b/mercurial/templatefilters.py --- a/mercurial/templatefilters.py +++ b/mercurial/templatefilters.py @@ -40,6 +40,9 @@ def age(date): return 'in the future' delta = max(1, int(now - then)) + if delta > agescales[0][1] * 2: + return util.shortdate(date) + for t, s in agescales: n = delta // s if n >= 2 or s == 1: diff --git a/tests/get-with-headers.py b/tests/get-with-headers.py --- a/tests/get-with-headers.py +++ b/tests/get-with-headers.py @@ -22,7 +22,6 @@ for h in headers: print "%s: %s" % (h, response.getheader(h)) print data = response.read() -data = re.sub('\d+ years', 'many years', data) sys.stdout.write(data) if 200 <= response.status <= 299: diff --git a/tests/test-hgweb-commands.out b/tests/test-hgweb-commands.out --- a/tests/test-hgweb-commands.out +++ b/tests/test-hgweb-commands.out @@ -210,17 +210,17 @@ files, or words in the commit messagedescription - many years ago + 1970-01-01 test branchstable tip - many years ago + 1970-01-01 test Added tag 1.0 for changeset 2ef0ac749a14default - many years ago + 1970-01-01 test base1.0 @@ -291,7 +291,7 @@ files, or words in the commit message date - Thu Jan 01 00:00:00 1970 +0000 (many years ago) + Thu Jan 01 00:00:00 1970 +0000 (1970-01-01) parents @@ -422,7 +422,7 @@ files, or words in the commit message date - Thu Jan 01 00:00:00 1970 +0000 (many years ago) + Thu Jan 01 00:00:00 1970 +0000 (1970-01-01) parents @@ -523,7 +523,7 @@ branches | - + - +
many years ago1970-01-01 1d22e65f027e stable
many years ago1970-01-01 a4f92ed23982 default