Mercurial > public > mercurial-scm > hg
diff mercurial/hgweb.py @ 1321:b47f96a178a3
Clean up date and timezone handling.
We used to pass changelog dates around as a "unixtime timezone" string
containing a pair of encoded ints. Now, they get passed around as a
(unixtime, timezone) tuple of numbers, which makes much more sense.
author | Bryan O'Sullivan <bos@serpentine.com> |
---|---|
date | Thu, 22 Sep 2005 23:19:47 -0700 |
parents | 5f277e73778f |
children | 77cd8068dbf4 |
line wrap: on
line diff
--- a/mercurial/hgweb.py Thu Sep 22 22:46:50 2005 -0700 +++ b/mercurial/hgweb.py Thu Sep 22 23:19:47 2005 -0700 @@ -27,7 +27,7 @@ return "%d %s" % (c, plural(t, c)) now = time.time() - then = int(x[2].split(' ')[0]) + then = x[2][0] delta = max(1, int(now - then)) scales = [["second", 1], @@ -155,13 +155,13 @@ common_filters = { "escape": cgi.escape, "age": age, - "date": util.datestr, + "date": lambda x: util.datestr(x[2]), "addbreaks": nl2br, "obfuscate": obfuscate, "short": (lambda x: x[:12]), "firstline": (lambda x: x.splitlines(1)[0]), "permissions": (lambda x: x and "-rwxr-xr-x" or "-rw-r--r--"), - "rfc822date": lambda x: util.datestr(x, "%a, %d %b %Y %H:%M:%S"), + "rfc822date": lambda x: util.datestr(x[2], "%a, %d %b %Y %H:%M:%S"), } class hgweb: @@ -185,7 +185,7 @@ self.allowpull = self.repo.ui.configbool("web", "allowpull", True) def date(self, cs): - return util.datestr(cs) + return util.datestr(cs[2]) def listfiles(self, files, mf): for f in files[:self.maxfiles]: