@@ -44,13 +44,20 @@ def __eq__(self, other) -> bool:
4444
4545class GitCommit (GitObject ):
4646 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 ,
4854 ):
4955 self .rev = rev .strip ()
5056 self .title = title .strip ()
5157 self .body = body .strip ()
5258 self .author = author .strip ()
5359 self .author_email = author_email .strip ()
60+ self .parents = parents or []
5461
5562 @property
5663 def message (self ):
@@ -137,14 +144,17 @@ def get_commits(
137144 for rev_and_commit in git_log_entries :
138145 if not rev_and_commit :
139146 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+ )
141150 if rev_and_commit :
142151 git_commit = GitCommit (
143152 rev = rev .strip (),
144153 title = title .strip (),
145154 body = "\n " .join (body_list ).strip (),
146155 author = author ,
147156 author_email = author_email ,
157+ parents = [p for p in parents .strip ().split (" " ) if p ],
148158 )
149159 git_commits .append (git_commit )
150160 return git_commits
@@ -286,7 +296,7 @@ def smart_open(*args, **kargs):
286296def _get_log_as_str_list (start : str | None , end : str , args : str ) -> list [str ]:
287297 """Get string representation of each log entry"""
288298 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"
290300 git_log_cmd = (
291301 f"git -c log.showSignature=False log --pretty={ log_format } { delimiter } { args } "
292302 )
0 commit comments