show dates in localtime, to match tinderbox
authorTed Mielczarek <ted.mielczarek@gmail.com>
Mon, 21 Jul 2008 15:36:44 -0400
changeset 31 c8b39f9d6c14b74fd9b82b0e757ab1ace7b8bc71
parent 30 141f44a7f8be15b1cf5922dd827beccbff0cc6ed
child 32 fa0ce7b3ce1a7f6a7a7caccb8a8e011daa4776bb
push id8
push usertmielczarek@mozilla.com
push dateMon, 21 Jul 2008 19:37:17 +0000
show dates in localtime, to match tinderbox
pushlog-feed.py
--- a/pushlog-feed.py
+++ b/pushlog-feed.py
@@ -2,16 +2,17 @@ import mercurial.hgweb.protocol as hgweb
 import mercurial.hgweb.webcommands as hgwebcommands
 from mercurial.templatefilters import xmlescape
 from mercurial.hgweb.common import HTTP_OK, HTTP_NOT_FOUND, HTTP_SERVER_ERROR, paritygen
 from mercurial.node import short, bin, hex
 from mercurial import demandimport
 
 import sys, os.path, re
 from datetime import datetime
+import time
 from math import ceil
 import sys
 
 demandimport.disable()
 try:
     import sqlite3 as sqlite
 except ImportError:
     from pysqlite2 import dbapi2 as sqlite
@@ -145,27 +146,34 @@ def pushlogHTML(web, req, tmpl):
         for i in range(start, end):
             nav.append({'page': i, 'label': str(i+1)})
         
         if page != numpages - 1:
             nav.append({'page': page + 1, 'label': "Next"})
             nav.append({'page': numpages - 1, 'label': "Last"})
         return nav
     
+    def localdate(ts):
+        t = time.localtime(ts)
+        offset = time.timezone
+        if t[8] == 1:
+            offset = time.altzone
+        return (ts, offset)
+
     def changelist(limit=0, **map):
         allentries = []
         lastid = None
         ch = None
         l = []
         for id, user, date, node in entries:
             if id != lastid:
                 lastid = id
                 l.append({"parity": parity.next(),
                           "user": user,
-                          "date": (date, 0),
+                          "date": localdate(date),
                           'numchanges': 0,
                           "changes": []})
                 ch = l[-1]['changes']
             ctx = web.repo.changectx(node)
             n = ctx.node()
             ch.append({"author": ctx.user(),
                        "desc": ctx.description(),
                        "files": web.listfilediffs(tmpl, ctx.files(), n),