--- vcpx/bzr.py.orig +++ vcpx/bzr.py @@ -180,7 +180,7 @@ """ Commit the changeset. """ - from time import mktime + from time import mktime, gmtime from binascii import hexlify from re import search from bzrlib.osutils import compact_date, rand_bytes @@ -196,7 +196,23 @@ else: self.log.info('Committing...') logmessage = "Empty changelog" - timestamp = int(mktime(date.timetuple())) + + t_l = int(mktime(date.timetuple())) + t_u = int(mktime(date.utctimetuple())) + + if not date.tzinfo: + timezone = t_u - mktime(gmtime(t_l)) + timestamp = t_l + timezone + else: + # XXX I would expect date.utcoffset().seconds to just work, as + # in, return a signed number of seconds <= 12*3600. However, the + # utcoffset() method of some tzinfo objects as defined by pytz seem + # to return eg. timedelta(-1, 68400) instead of timedelta(0, -18000), + # thus making the abs() and .days play necessary. --dato + timezone = abs(date.utcoffset()).seconds + if date.utcoffset().days == -1: + timezone *= -1 + timestamp = 2*t_u - mktime(gmtime(t_u)) # Guess sane email address email = search("<(.*@.*)>", author) @@ -216,7 +232,7 @@ self._working_tree.commit(logmessage, committer=author, specific_files=entries, rev_id=revision_id, verbose=self.repository.projectref().verbose, - timestamp=timestamp) + timestamp=timestamp, timezone=timezone) def _removePathnames(self, names): """