changeset 594:ce6ad4c0cba7

scrub bad timezone values before dulwich sees them If dulwich is presented with a "sub minute" timezone offset, it throws an exception (see tests/test-timezone.t). This patch rounds the timezone down to the next minute before passing the value to dulwich.
author Hal Wine <hwine@mozilla.com>
date Tue, 05 Feb 2013 08:25:37 -0800
parents a6b7ad535244
children a3c3b8077cbe
files hggit/git_handler.py
diffstat 1 files changed, 6 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/hggit/git_handler.py
+++ b/hggit/git_handler.py
@@ -376,6 +376,12 @@
         commit = Commit()
 
         (time, timezone) = ctx.date()
+        # work around to bad timezone offets - dulwich does not handle
+        # sub minute based timezones. In the one known case, it was a
+        # manual edit that led to the unusual value. Based on that,
+        # there is no reason to round one way or the other, so do the
+        # simplest and round down.
+        timezone -= (timezone % 60)
         commit.author = self.get_git_author(ctx)
         commit.author_time = int(time)
         commit.author_timezone = -timezone