summaryrefslogtreecommitdiff
path: root/git/objects/commit.py
diff options
context:
space:
mode:
authorSebastian Thiel <byronimo@gmail.com>2016-04-20 09:00:25 +0200
committerSebastian Thiel <byronimo@gmail.com>2016-04-20 09:00:25 +0200
commitd04aeaa17e628f13d1a590a32ae96bc7d35775b5 (patch)
tree36ea8e5dd06b5e8c671e39a2185675042787ef38 /git/objects/commit.py
parentfcb6e8832a94776d670095935a7da579a111c028 (diff)
parentf77f9775277a100c7809698c75cb0855b07b884d (diff)
downloadgitpython-d04aeaa17e628f13d1a590a32ae96bc7d35775b5.tar.gz
Merge pull request #414 from nvie/support-full-datetimes-on-commits
Add support for getting "aware" datetime info
Diffstat (limited to 'git/objects/commit.py')
-rw-r--r--git/objects/commit.py11
1 files changed, 10 insertions, 1 deletions
diff --git a/git/objects/commit.py b/git/objects/commit.py
index d067b718..dc722f97 100644
--- a/git/objects/commit.py
+++ b/git/objects/commit.py
@@ -21,7 +21,8 @@ from .util import (
Serializable,
parse_date,
altz_to_utctz_str,
- parse_actor_and_date
+ parse_actor_and_date,
+ from_timestamp,
)
from git.compat import text_type
@@ -145,6 +146,14 @@ class Commit(base.Object, Iterable, Diffable, Traversable, Serializable):
# END handle attrs
@property
+ def authored_datetime(self):
+ return from_timestamp(self.authored_date, self.author_tz_offset)
+
+ @property
+ def committed_datetime(self):
+ return from_timestamp(self.committed_date, self.committer_tz_offset)
+
+ @property
def summary(self):
""":return: First line of the commit message"""
return self.message.split('\n', 1)[0]