summaryrefslogtreecommitdiff
path: root/lib/git/objects/utils.py
diff options
context:
space:
mode:
authorRick Copeland <rcopeland@geek.net>2010-04-27 16:34:39 -0400
committerRick Copeland <rcopeland@geek.net>2010-04-27 16:38:35 -0400
commitb48e4d3aa853687f420dc51969837734b70bfdec (patch)
tree6d33df26dffe527e9a2c3835f8cae379b836a1f4 /lib/git/objects/utils.py
parent82b8902e033430000481eb355733cd7065342037 (diff)
downloadgitpython-b48e4d3aa853687f420dc51969837734b70bfdec.tar.gz
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
Diffstat (limited to 'lib/git/objects/utils.py')
-rw-r--r--lib/git/objects/utils.py8
1 files changed, 4 insertions, 4 deletions
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 <tom@mojombo.com> 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))