[PATCH 1 of 2] templating: fix age() function to return 1 minute, 1 hour, 1 day etc

Matt Mackall mpm at selenic.com
Mon Dec 19 15:20:18 CST 2011


On Mon, 2011-12-19 at 06:58 +0700, Andrei Polushin wrote:
> # HG changeset patch
> # User Andrei Polushin <polushin at gmail.com>
> # Date 1324251074 -25200
> # Node ID 4c2fc9ea89079ea2ad53334fcd13b649f5b14ba7
> # Parent  7b7f03502b5aa9cbe3fa254d9bedb70b4dd4d205
> templating: fix age() function to return 1 minute, 1 hour, 1 day etc.
> 
> The existence of plural() function earlier in code show the intent to make
> singular/plural forms, while the condition '>= 2' disables all singular forms
> other than '1 second'.

Incorrect. It merely demonstrates the developer who committed plural()
in hgweb (me, 23 May 2005) was not yet aware of our long-standing policy
of avoiding the pointless complexity of pluralization. The vast bulk of
the code intentionally makes no effort to deal with pluralization and
we've rejected dozens of patches to fix "1 files" and other
pluralization special-cases.

Further, the >= 2 code is actually better from an accuracy point of
view. With it, we get results like "23 months", which is better than "1
year".

-- 
Mathematics is the supreme nostalgia of our time.




More information about the Mercurial-devel mailing list