halim  committed 7335932

hggtk: display commit dates in local time

  • Participants
  • Parent commits b1473f4
  • Branches default

Comments (0)

Files changed (5)

File contrib/

 import tempfile
 import time
 import urllib
+from hggtk.hglib import displaytime
 TORTOISEHG_PATH = '~/tools/tortoisehg-dev'
 TERMINAL_KEY = '/desktop/gnome/applications/terminal/exec'
             rev = ctx.rev()
         ctx = repo.changectx(rev)
         node = short(ctx.node())
-        date = time.strftime("%Y-%m-%d %H:%M:%S", time.gmtime([0]))
+        date = displaytime(
         parents = '\n'.join([short(p.node()) for p in ctx.parents()])
         description = ctx.description()
         user = ctx.user()

File hggtk/

 from mercurial import context, patch, revlog
 from gdialog import *
 from hgcmd import CmdDialog
-from hglib import toutf, fromutf
+from hglib import toutf, fromutf, displaytime
 from gtklib import StatusBar
 class ChangeSet(GDialog):
     """GTK+ based dialog for displaying repository logs
         # TODO: Add toggle for gmtime/localtime
         eob = buf.get_end_iter()
-        date = time.strftime("%Y-%m-%d %H:%M:%S", time.gmtime([0]))
+        date = displaytime(
         if self.clipboard:
         change = str(rev) + ':' + short(ctx.node())

File hggtk/

 import threading, thread2
 import time
 from mercurial import hg, ui, util, revlog
-from hglib import hgcmd_toq, toutf, fromutf, gettabwidth
+from hglib import hgcmd_toq, toutf, fromutf, gettabwidth, displaytime
 from gdialog import *
 from vis import treemodel
 from vis.colormap import AnnotateColorMap, AnnotateColorSaturation
         author = util.shortuser(ctx.user())
         summary = ctx.description().replace('\0', '')
         summary = summary.split('\n')[0]
-        date = time.strftime("%y-%m-%d %H:%M", time.gmtime([0]))
+        date = displaytime(
         desc = author+'@'+str(rev)+' '+date+' "'+summary+'"'
         self.changedesc[rev] = (desc, author)
         return (desc, author)

File hggtk/

     u = Qui()
     return thgdispatch(u, path, list(args))
+def displaytime(date):
+    return util.datestr(date, '%Y-%m-%d %H:%M:%S %1%2')

File hggtk/vis/

 import gtk
 import gobject
 import re
-from time import (strftime, gmtime)
 from mercurial import util
 from mercurial.node import short
 from mercurial.hgweb import webutil
 # Besides, we want to be compatible older Python versions.
     # when is invoked directly
-    from hglib import toutf
+    from hglib import toutf, displaytime
 except ImportError:
     # when is imported and called from
-    from hggtk.hglib import toutf
+    from hggtk.hglib import toutf, displaytime
 # treemodel row enumerated attributes
 LINES = 0
                 author = toutf(util.shortuser(ctx.user()))
-            date = strftime("%Y-%m-%d %H:%M:%S", gmtime([0]))
+            date = displaytime(
             wc_parent = revid in self.parents
             head = revid in self.heads