[Pkg-bazaar-commits] ./bzr/unstable r12: new --timezone option for bzr log
mbp at sourcefrog.net
mbp at sourcefrog.net
Fri Apr 10 07:24:49 UTC 2009
------------------------------------------------------------
revno: 12
committer: mbp at sourcefrog.net
timestamp: Wed 2005-03-09 18:00:48 +1100
message:
new --timezone option for bzr log
modified:
bzr.py
bzrlib/branch.py
bzrlib/osutils.py
bzrlib/tests.py
-------------- next part --------------
=== modified file 'bzr.py'
--- a/bzr.py 2005-03-09 06:44:53 +0000
+++ b/bzr.py 2005-03-09 07:00:48 +0000
@@ -324,12 +324,12 @@
-def cmd_log():
+def cmd_log(timezone):
"""Show log of this branch.
:todo: Options for utc; to show ids; to limit range; etc.
"""
- Branch('.').write_log()
+ Branch('.').write_log(show_timezone=timezone)
def cmd_ls(revision=None, verbose=False):
@@ -496,6 +496,7 @@
'message': unicode,
'revision': int,
'show-ids': None,
+ 'timezone': str,
'verbose': None,
'version': None,
}
@@ -513,10 +514,10 @@
'commit': ['message', 'verbose'],
'diff': ['revision'],
'inventory': ['revision'],
+ 'log': ['show-ids', 'timezone'],
'ls': ['revision', 'verbose'],
+ 'remove': ['verbose'],
'status': ['all'],
- 'log': ['show-ids'],
- 'remove': ['verbose'],
}
=== modified file 'bzrlib/branch.py'
--- a/bzrlib/branch.py 2005-03-09 06:48:20 +0000
+++ b/bzrlib/branch.py 2005-03-09 07:00:48 +0000
@@ -612,7 +612,7 @@
- def write_log(self, utc=False):
+ def write_log(self, show_timezone='original'):
"""Write out human-readable log of commits to this branch
:param utc: If true, show dates in universal time, not local time."""
@@ -626,7 +626,8 @@
##print 'revision-hash:', p
rev = self.get_revision(p)
print 'committer:', rev.committer
- print 'timestamp: %s' % (format_date(rev.timestamp, rev.timezone or 0))
+ print 'timestamp: %s' % (format_date(rev.timestamp, rev.timezone or 0,
+ show_timezone))
## opportunistic consistency check, same as check_patch_chaining
if rev.precursor != precursor:
=== modified file 'bzrlib/osutils.py'
--- a/bzrlib/osutils.py 2005-03-09 06:44:53 +0000
+++ b/bzrlib/osutils.py 2005-03-09 07:00:48 +0000
@@ -186,10 +186,12 @@
offset = 0
elif timezone == 'original':
tt = time.gmtime(t - offset)
- else:
- assert timezone == 'local'
+ elif timezone == 'local':
tt = time.localtime(t)
offset = local_time_offset()
+ else:
+ bailout("unsupported timezone format %r",
+ ['options are "utc", "original", "local"'])
return (time.strftime("%a %Y-%m-%d %H:%M:%S", tt)
+ ' %+03d%02d' % (offset / 3600, (offset / 60) % 60))
=== modified file 'bzrlib/tests.py'
--- a/bzrlib/tests.py 2005-03-09 04:08:15 +0000
+++ b/bzrlib/tests.py 2005-03-09 07:00:48 +0000
@@ -103,11 +103,11 @@
>>> r = b.get_revision(b.lookup_revision(1))
>>> r.message
'start hello world'
- >>> b.write_log(utc=True)
+ >>> b.write_log(show_timezone='utc')
----------------------------------------
revno: 1
committer: foo at nowhere
- timestamp: Thu 1970-01-01 00:00:00 UTC +0000
+ timestamp: Thu 1970-01-01 00:00:00 +0000
message:
start hello world
More information about the Pkg-bazaar-commits
mailing list