diff options
author | Sebastian Thiel <byronimo@gmail.com> | 2010-04-30 09:30:05 +0200 |
---|---|---|
committer | Sebastian Thiel <byronimo@gmail.com> | 2010-04-30 09:30:05 +0200 |
commit | b75c3103a700ac65b6cd18f66e2d0a07cfc09797 (patch) | |
tree | 045df74b6615d2f8505199d5e71d07f40fc4edee /lib/git/objects/commit.py | |
parent | 69361d96a59381fde0ac34d19df2d4aff05fb9a9 (diff) | |
parent | b48e4d3aa853687f420dc51969837734b70bfdec (diff) | |
download | gitpython-b75c3103a700ac65b6cd18f66e2d0a07cfc09797.tar.gz |
Merge commit 'refs/merge-requests/14' of git://gitorious.org/git-python/mainline into integration
Diffstat (limited to 'lib/git/objects/commit.py')
-rw-r--r-- | lib/git/objects/commit.py | 28 |
1 files changed, 20 insertions, 8 deletions
diff --git a/lib/git/objects/commit.py b/lib/git/objects/commit.py index d1bbb889..4a0e278d 100644 --- a/lib/git/objects/commit.py +++ b/lib/git/objects/commit.py @@ -23,12 +23,14 @@ class Commit(base.Object, Iterable, diff.Diffable, utils.Traversable): # object configuration type = "commit" - __slots__ = ("tree", "author", "authored_date", "committer", "committed_date", - "message", "parents") + __slots__ = ("tree", + "author", "authored_date", "author_tz_offset", + "committer", "committed_date", "committer_tz_offset", + "message", "parents") _id_attribute_ = "sha" - def __init__(self, repo, sha, tree=None, author=None, authored_date=None, - committer=None, committed_date=None, message=None, parents=None): + def __init__(self, repo, sha, tree=None, author=None, authored_date=None, author_tz_offset=None, + committer=None, committed_date=None, committer_tz_offset=None, message=None, parents=None): """ Instantiate a new Commit. All keyword arguments taking None as default will be implicitly set if id names a valid sha. @@ -51,6 +53,9 @@ class Commit(base.Object, Iterable, diff.Diffable, utils.Traversable): is the authored DateTime - use time.gmtime() to convert it into a different format + ``author_tz_offset``: int_seconds_west_of_utc + is the timezone that the authored_date is in + ``committer`` : Actor is the committer string @@ -58,6 +63,9 @@ class Commit(base.Object, Iterable, diff.Diffable, utils.Traversable): is the committed DateTime - use time.gmtime() to convert it into a different format + ``committer_tz_offset``: int_seconds_west_of_utc + is the timezone that the authored_date is in + ``message`` : string is the commit message @@ -94,8 +102,10 @@ class Commit(base.Object, Iterable, diff.Diffable, utils.Traversable): self.tree = temp.tree self.author = temp.author self.authored_date = temp.authored_date + self.author_tz_offset = temp.author_tz_offset self.committer = temp.committer self.committed_date = temp.committed_date + self.committer_tz_offset = temp.committer_tz_offset self.message = temp.message else: super(Commit, self)._set_cache_(attr) @@ -253,8 +263,8 @@ class Commit(base.Object, Iterable, diff.Diffable, utils.Traversable): parents.append(parent_line.split()[-1]) # END for each parent line - author, authored_date = utils.parse_actor_and_date(next_line) - committer, committed_date = utils.parse_actor_and_date(stream.next()) + author, authored_date, author_tz_offset = utils.parse_actor_and_date(next_line) + committer, committed_date, committer_tz_offset = utils.parse_actor_and_date(stream.next()) # empty line stream.next() @@ -276,8 +286,10 @@ class Commit(base.Object, Iterable, diff.Diffable, utils.Traversable): # END message parsing message = '\n'.join(message_lines) - yield Commit(repo, id, parents=tuple(parents), tree=tree, author=author, authored_date=authored_date, - committer=committer, committed_date=committed_date, message=message) + yield Commit(repo, id, parents=tuple(parents), tree=tree, + author=author, authored_date=authored_date, author_tz_offset=author_tz_offset, + committer=committer, committed_date=committed_date, committer_tz_offset=committer_tz_offset, + message=message) # END for each line in stream |