Mercurial > public > mercurial-scm > hg
comparison 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 |
comparison
equal
deleted
inserted
replaced
1985:c577689006fa | 1987:04c17fc39c84 |
---|---|
742 tz = time.altzone | 742 tz = time.altzone |
743 else: | 743 else: |
744 tz = time.timezone | 744 tz = time.timezone |
745 return time.mktime(lt), tz | 745 return time.mktime(lt), tz |
746 | 746 |
747 def datestr(date=None, format='%a %b %d %H:%M:%S %Y'): | 747 def datestr(date=None, format='%a %b %d %H:%M:%S %Y', timezone=True): |
748 """represent a (unixtime, offset) tuple as a localized time. | 748 """represent a (unixtime, offset) tuple as a localized time. |
749 unixtime is seconds since the epoch, and offset is the time zone's | 749 unixtime is seconds since the epoch, and offset is the time zone's |
750 number of seconds away from UTC.""" | 750 number of seconds away from UTC. if timezone is false, do not |
751 append time zone to string.""" | |
751 t, tz = date or makedate() | 752 t, tz = date or makedate() |
752 return ("%s %+03d%02d" % | 753 s = time.strftime(format, time.gmtime(float(t) - tz)) |
753 (time.strftime(format, time.gmtime(float(t) - tz)), | 754 if timezone: |
754 -tz / 3600, | 755 s += " %+03d%02d" % (-tz / 3600, ((-tz % 3600) / 60)) |
755 ((-tz % 3600) / 60))) | 756 return s |
756 | 757 |
757 def shortuser(user): | 758 def shortuser(user): |
758 """Return a short representation of a user name or email address.""" | 759 """Return a short representation of a user name or email address.""" |
759 f = user.find('@') | 760 f = user.find('@') |
760 if f >= 0: | 761 if f >= 0: |