diff options
author | Sebastian Thiel <byronimo@gmail.com> | 2009-10-11 21:17:59 +0200 |
---|---|---|
committer | Sebastian Thiel <byronimo@gmail.com> | 2009-10-11 21:17:59 +0200 |
commit | 708b8dda8e7b87841a5f39c60b799c514e75a9c7 (patch) | |
tree | 0726d95c0ad6270278c6695381522e8a5f8a2b76 /lib/git/commit.py | |
parent | ccde80b7a3037a004a7807a6b79916ce2a1e9729 (diff) | |
download | gitpython-708b8dda8e7b87841a5f39c60b799c514e75a9c7.tar.gz |
commit: fixed failing commit tests as the mocked git command would always return the same thing which does not work anymore - re-implemented it in a more dynamic manner, but in the end tests will have to be revised anyway
Added slots to Diff and Stats type respectively
Diffstat (limited to 'lib/git/commit.py')
-rw-r--r-- | lib/git/commit.py | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/lib/git/commit.py b/lib/git/commit.py index 5d494621..9bf753e0 100644 --- a/lib/git/commit.py +++ b/lib/git/commit.py @@ -162,8 +162,7 @@ class Commit(base.Object): Returns git.Commit[] """ - lines = [l for l in text.splitlines() if l.strip('\r\n')] - + lines =text.splitlines(False) commits = [] while lines: @@ -173,18 +172,22 @@ class Commit(base.Object): parents = [] while lines and lines[0].startswith('parent'): parents.append(lines.pop(0).split()[-1]) + # END while there are parent lines author, authored_date = cls._actor(lines.pop(0)) committer, committed_date = cls._actor(lines.pop(0)) - + + # free line + lines.pop(0) + messages = [] - while lines and lines[0].startswith(' '): + while lines and not lines[0].startswith('commit'): messages.append(lines.pop(0).strip()) - + # END while there are message lines message = '\n'.join(messages) commits.append(Commit(repo, id=id, parents=parents, tree=tree, author=author, authored_date=authored_date, committer=committer, committed_date=committed_date, message=message)) - + # END while lines return commits @classmethod |