Mercurial > public > mercurial-scm > hg-stable
diff mercurial/util.py @ 1987:04c17fc39c84
add changelog style to command line template.
to use, "hg log --style=changelog". makes different output with no
flags, -q, -v, --debug.
templater module has new template filters for this.
email - committer email address
fill68 - refill text to 68 colums
fill76 - refill text to 76 colums
tabindent - prefix every not empty line with tab
shortdate - iso 8631 date, no time zone
stringify - turn template iterator into string
author | Vadim Gelfer <vadim.gelfer@gmail.com> |
---|---|
date | Tue, 21 Mar 2006 23:29:21 -0800 |
parents | df8416346bb7 |
children | a8a618c57690 |
line wrap: on
line diff
--- a/mercurial/util.py Tue Mar 21 15:33:29 2006 +0100 +++ b/mercurial/util.py Tue Mar 21 23:29:21 2006 -0800 @@ -744,15 +744,16 @@ tz = time.timezone return time.mktime(lt), tz -def datestr(date=None, format='%a %b %d %H:%M:%S %Y'): +def datestr(date=None, format='%a %b %d %H:%M:%S %Y', timezone=True): """represent a (unixtime, offset) tuple as a localized time. unixtime is seconds since the epoch, and offset is the time zone's - number of seconds away from UTC.""" + number of seconds away from UTC. if timezone is false, do not + append time zone to string.""" t, tz = date or makedate() - return ("%s %+03d%02d" % - (time.strftime(format, time.gmtime(float(t) - tz)), - -tz / 3600, - ((-tz % 3600) / 60))) + s = time.strftime(format, time.gmtime(float(t) - tz)) + if timezone: + s += " %+03d%02d" % (-tz / 3600, ((-tz % 3600) / 60)) + return s def shortuser(user): """Return a short representation of a user name or email address."""