diff mercurial/commands.py @ 1320:5f277e73778f

Fix up representation of dates in hgweb. Date display is now uniform both on the command line and via the web interface.
author Bryan O'Sullivan <bos@serpentine.com>
date Thu, 22 Sep 2005 22:46:50 -0700
parents 5a15df632e6a
children b47f96a178a3
line wrap: on
line diff
--- a/mercurial/commands.py	Thu Sep 22 21:42:33 2005 -0700
+++ b/mercurial/commands.py	Thu Sep 22 22:46:50 2005 -0700
@@ -30,20 +30,6 @@
         return [util.normpath(os.path.join(cwd, x)) for x in args]
     return args
 
-def datestr(change=None):
-    if change is None:
-        t = time.time()
-        if time.daylight: tz = time.altzone
-        else: tz = time.timezone
-    else:
-        t, tz = change[2].split(' ')
-        try:
-            # a conversion tool was sticking non-integer offsets into repos
-            tz = int(tz)
-        except ValueError:
-            tz = 0
-    return time.asctime(time.gmtime(float(t) - tz)) + " %+05d" % (int(tz)/-36)
-
 def matchpats(repo, cwd, pats=[], opts={}, head=''):
     return util.matcher(repo.root, cwd, pats or ['.'], opts.get('include'),
                         opts.get('exclude'), head)
@@ -278,11 +264,11 @@
     if node2:
         change = repo.changelog.read(node2)
         mmap2 = repo.manifest.read(change[0])
-        date2 = datestr(change)
+        date2 = util.datestr(change)
         def read(f):
             return repo.file(f).read(mmap2[f])
     else:
-        date2 = datestr()
+        date2 = util.datestr()
         if not node1:
             node1 = repo.dirstate.parents()[0]
         def read(f):
@@ -296,7 +282,7 @@
 
     change = repo.changelog.read(node1)
     mmap = repo.manifest.read(change[0])
-    date1 = datestr(change)
+    date1 = util.datestr(change)
 
     for f in c:
         to = None
@@ -333,7 +319,7 @@
         return
 
     changes = log.read(changenode)
-    date = datestr(changes)
+    date = util.datestr(changes)
 
     parents = [(log.rev(p), ui.verbose and hex(p) or short(p))
                for p in log.parents(changenode)