@@ -44,13 +44,20 @@ def __eq__(self, other) -> bool:
44
44
45
45
class GitCommit (GitObject ):
46
46
def __init__ (
47
- self , rev , title , body : str = "" , author : str = "" , author_email : str = ""
47
+ self ,
48
+ rev ,
49
+ title ,
50
+ body : str = "" ,
51
+ author : str = "" ,
52
+ author_email : str = "" ,
53
+ parents : list [str ] | None = None ,
48
54
):
49
55
self .rev = rev .strip ()
50
56
self .title = title .strip ()
51
57
self .body = body .strip ()
52
58
self .author = author .strip ()
53
59
self .author_email = author_email .strip ()
60
+ self .parents = parents or []
54
61
55
62
@property
56
63
def message (self ):
@@ -137,14 +144,17 @@ def get_commits(
137
144
for rev_and_commit in git_log_entries :
138
145
if not rev_and_commit :
139
146
continue
140
- rev , title , author , author_email , * body_list = rev_and_commit .split ("\n " )
147
+ rev , parents , title , author , author_email , * body_list = rev_and_commit .split (
148
+ "\n "
149
+ )
141
150
if rev_and_commit :
142
151
git_commit = GitCommit (
143
152
rev = rev .strip (),
144
153
title = title .strip (),
145
154
body = "\n " .join (body_list ).strip (),
146
155
author = author ,
147
156
author_email = author_email ,
157
+ parents = [p for p in parents .strip ().split (" " ) if p ],
148
158
)
149
159
git_commits .append (git_commit )
150
160
return git_commits
@@ -286,7 +296,7 @@ def smart_open(*args, **kargs):
286
296
def _get_log_as_str_list (start : str | None , end : str , args : str ) -> list [str ]:
287
297
"""Get string representation of each log entry"""
288
298
delimiter = "----------commit-delimiter----------"
289
- log_format : str = "%H%n%s%n%an%n%ae%n%b"
299
+ log_format : str = "%H%n%P%n% s%n%an%n%ae%n%b"
290
300
git_log_cmd = (
291
301
f"git -c log.showSignature=False log --pretty={ log_format } { delimiter } { args } "
292
302
)
0 commit comments