On Tue, Jan 13, 2009 at 12:53 PM, Abdul Halim <[email protected]> wrote: > On Tue, Jan 13, 2009 at 12:35 PM, TK Soh <[email protected]> wrote: >> On Tue, Jan 13, 2009 at 3:11 AM, halim <[email protected]> wrote: >>> # HG changeset patch >>> # User halim <[email protected]> >>> # Date 1231809879 -28800 >>> # Node ID 51d34673146b5424b840b12618018cd086522ac6 >>> # Parent 13746bb5a4b74bb6057ab54eb931604dfcda4671 >>> changeset, history, datamine, nautilus: display in localtime >>> >>> diff -r 13746bb5a4b7 -r 51d34673146b contrib/nautilus-thg.py >>> --- a/contrib/nautilus-thg.py Fri Jan 09 22:39:56 2009 -0600 >>> +++ b/contrib/nautilus-thg.py Tue Jan 13 09:24:39 2009 +0800 >>> @@ -21,6 +21,7 @@ >>> import tempfile >>> import time >>> import urllib >>> +from tortoise import datetime >>> >>> TORTOISEHG_PATH = '~/tools/tortoisehg-dev' >>> TERMINAL_KEY = '/desktop/gnome/applications/terminal/exec' >>> @@ -513,7 +514,7 @@ >>> rev = ctx.rev() >>> ctx = repo.changectx(rev) >>> node = short(ctx.node()) >>> - date = time.strftime("%Y-%m-%d %H:%M:%S", >>> time.gmtime(ctx.date()[0])) >>> + date = datetime.displaytime(ctx.date()) >>> parents = '\n'.join([short(p.node()) for p in ctx.parents()]) >>> description = ctx.description() >>> user = ctx.user() >>> diff -r 13746bb5a4b7 -r 51d34673146b hggtk/changeset.py >>> --- a/hggtk/changeset.py Fri Jan 09 22:39:56 2009 -0600 >>> +++ b/hggtk/changeset.py Tue Jan 13 09:24:39 2009 +0800 >>> @@ -24,7 +24,7 @@ >>> from hgcmd import CmdDialog >>> from hglib import toutf, fromutf >>> from gtklib import StatusBar >>> - >>> +from tortoise import datetime >>> >>> class ChangeSet(GDialog): >>> """GTK+ based dialog for displaying repository logs >>> @@ -120,7 +120,7 @@ >>> >>> # TODO: Add toggle for gmtime/localtime >>> eob = buf.get_end_iter() >>> - date = time.strftime("%Y-%m-%d %H:%M:%S", >>> time.gmtime(ctx.date()[0])) >>> + date = datetime.displaytime(ctx.date()) >>> if self.clipboard: >>> self.clipboard.set_text(short(ctx.node())) >>> change = str(rev) + ':' + short(ctx.node()) >>> diff -r 13746bb5a4b7 -r 51d34673146b hggtk/datamine.py >>> --- a/hggtk/datamine.py Fri Jan 09 22:39:56 2009 -0600 >>> +++ b/hggtk/datamine.py Tue Jan 13 09:24:39 2009 +0800 >>> @@ -20,6 +20,7 @@ >>> from vis.colormap import AnnotateColorMap, AnnotateColorSaturation >>> from vis.treeview import TreeView >>> import gtklib >>> +from tortoise import datetime >>> >>> class DataMineDialog(GDialog): >>> COL_REVID = 0 >>> @@ -148,7 +149,7 @@ >>> 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(ctx.date()[0])) >>> + date = datetime.displaytime(ctx.date()) >>> desc = author+'@'+str(rev)+' '+date+' "'+summary+'"' >>> self.changedesc[rev] = (desc, author) >>> return (desc, author) >>> diff -r 13746bb5a4b7 -r 51d34673146b hggtk/vis/treemodel.py >>> --- a/hggtk/vis/treemodel.py Fri Jan 09 22:39:56 2009 -0600 >>> +++ b/hggtk/vis/treemodel.py Tue Jan 13 09:24:39 2009 +0800 >>> @@ -10,8 +10,8 @@ >>> import gtk >>> import gobject >>> import re >>> -from time import (strftime, gmtime) >>> from mercurial import util >>> +from tortoise import datetime >>> from mercurial.node import short >>> from mercurial.hgweb import webutil >>> >>> @@ -128,7 +128,7 @@ >>> else: >>> author = toutf(util.shortuser(ctx.user())) >>> >>> - date = strftime("%Y-%m-%d %H:%M:%S", gmtime(ctx.date()[0])) >>> + date = datetime.displaytime(ctx.date()) >>> >>> wc_parent = revid in self.parents >>> head = revid in self.heads >>> diff -r 13746bb5a4b7 -r 51d34673146b tortoise/datetime.py >>> --- /dev/null Thu Jan 01 00:00:00 1970 +0000 >>> +++ b/tortoise/datetime.py Tue Jan 13 09:24:39 2009 +0800 >>> @@ -0,0 +1,7 @@ >>> +from mercurial import util >>> + >>> +def locatime(date): >>> + return util.datestr(date) >>> + >>> +def displaytime(date): >>> + return locatime(date) >> >> I don't understand. This is redundant. Why not just call util.datetr() >> directly? Also, the default date format in util.datetr() is not what >> we want. You should use the format "%Y-%m-%d %H:%M:%S %1%2". >> > > Maintainability sake. Any changes to tortoisehg date time format will be in > a single file or location. No need for changes across the board. > And your requested time format can be changed with a one liner too in this > way. >
Any concerns? Me going to send the patch with the new commit message and the one liner change for datetime format .. ie with tortoise/datetime.py... ------------------------------------------------------------------------------ This SF.net email is sponsored by: SourcForge Community SourceForge wants to tell your story. http://p.sf.net/sfu/sf-spreadtheword _______________________________________________ Tortoisehg-develop mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/tortoisehg-develop
