From b48e4d3aa853687f420dc51969837734b70bfdec Mon Sep 17 00:00:00 2001 From: Rick Copeland Date: Tue, 27 Apr 2010 16:34:39 -0400 Subject: Add support for time zone information in tags and commits. This commit includes - an update to git.objects.utils:parse_actor_and_date to parse the timezone offset - updates to the git.objects.Commit and git.objects.Tag objects to support *_tz_offset attributes - updates to tests in test.git.test_commit and test.git.test_refs to check for appropriate *_tz_offset attributes --- lib/git/objects/utils.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'lib/git/objects/utils.py') diff --git a/lib/git/objects/utils.py b/lib/git/objects/utils.py index ec5453f1..4f17b652 100644 --- a/lib/git/objects/utils.py +++ b/lib/git/objects/utils.py @@ -39,7 +39,7 @@ def get_object_type_by_name(object_type_name): # precompiled regex -_re_actor_epoch = re.compile(r'^.+? (.*) (\d+) .*$') +_re_actor_epoch = re.compile(r'^.+? (.*) (\d+) ([+-]\d+).*$') def parse_actor_and_date(line): """ @@ -48,11 +48,11 @@ def parse_actor_and_date(line): author Tom Preston-Werner 1191999972 -0700 Returns - [Actor, int_seconds_since_epoch] + [Actor, int_seconds_since_epoch, int_timezone_offset] """ m = _re_actor_epoch.search(line) - actor, epoch = m.groups() - return (Actor._from_string(actor), int(epoch)) + actor, epoch, offset = m.groups() + return (Actor._from_string(actor), int(epoch), -int(float(offset)/100*3600)) -- cgit v1.2.1