[patch] commit timestamp incorrectly cast if specified
Jamie Wilkinson
jaq at spacepants.org
Tue Jan 17 10:57:14 GMT 2006
I found an interesting quirk whilst testing a plugin that iterates over
revisions in a branch.
The pseudocode looks like:
rev_a = branch_a.get_revision(revno)
branch_b.commit(rev_a.message, rev_a.timestamp, rev_a.timezone, ...)
rev_b = branch_b.get_revision(branch_b.last_revision())
assertEqual(rev_a.timestamp, rev_b.timestamp)
and fails because rev_b.timestamp appears to be truncated.
commit.py:219 reads thusly:
if timestamp is None:
self.timestamp = time.time()
else:
self.timestamp = long(timestamp)
pydoc time.time tells me that time.time() returns a floating point number.
I think the last line above shouldn't be casting to long.
I've got a test for this in my branch, revno 1536, and a patch to fix it in
revno 1537:
http://repo.spacepants.org/bzr/bzr.jaq
(This URL has changed since my last patch.)
More information about the bazaar
mailing list