@@ -648,6 +648,11 @@ def labels(self) -> Union[list["PRLabel"], Iterable["PRLabel"]]:
648648 """Labels of the pull request."""
649649 raise NotImplementedError ()
650650
651+ @property
652+ def changes (self ) -> "PullRequestChanges" :
653+ """Commit-like change information."""
654+ raise NotImplementedError ()
655+
651656 @property
652657 def diff_url (self ) -> str :
653658 """Web URL to the diff of the pull request."""
@@ -1097,6 +1102,89 @@ def __str__(self) -> str:
10971102 )
10981103
10991104
1105+ class CommitLikeChanges (OgrAbstractClass ):
1106+ """
1107+ Class representing a commit-like changes.
1108+
1109+ Can be from a single commit or aggregated like from a PR.
1110+ """
1111+
1112+ @property
1113+ def parent (self ) -> Union ["GitCommit" , "PullRequest" ]:
1114+ """Parent object containing the changes."""
1115+ raise NotImplementedError
1116+
1117+ @property
1118+ def files (self ) -> Union [list [str ], Iterable [str ]]:
1119+ """Files changed by the current change."""
1120+ raise NotImplementedError
1121+
1122+ @property
1123+ def patch (self ) -> bytes :
1124+ """Patch of the changes."""
1125+ raise NotImplementedError
1126+
1127+ @property
1128+ def diff_url (self ) -> str :
1129+ """Web URL to the diff of the pull request."""
1130+ raise NotImplementedError ()
1131+
1132+
1133+ class CommitChanges (CommitLikeChanges ):
1134+ """
1135+ Class representing a Commit's change
1136+
1137+ Attributes:
1138+ commit (GitCommit): Parent commit.
1139+ """
1140+
1141+ def __init__ (self , commit : "GitCommit" ) -> None :
1142+ self .commit = commit
1143+
1144+ @property
1145+ def parent (self ) -> "GitCommit" :
1146+ return self .commit
1147+
1148+
1149+ class PullRequestChanges (CommitLikeChanges ):
1150+ """
1151+ Class representing a PullRequest's changes
1152+
1153+ Attributes:
1154+ pull_request (PullRequest): Parent pull request.
1155+ """
1156+
1157+ def __init__ (self , pull_request : "PullRequest" ) -> None :
1158+ self .pull_request = pull_request
1159+
1160+ @property
1161+ def parent (self ) -> "PullRequest" :
1162+ return self .pull_request
1163+
1164+
1165+ class GitCommit (OgrAbstractClass ):
1166+ """
1167+ Class representing a git commit
1168+
1169+ Attributes:
1170+ project (GitProject): Git project where the commit belongs to.
1171+ """
1172+
1173+ def __init__ (self , raw_commit : Any , project : "GitProject" ) -> None :
1174+ self ._raw_commit = raw_commit
1175+ self .project = project
1176+
1177+ @property
1178+ def sha (self ) -> str :
1179+ """Commit hash."""
1180+ raise NotImplementedError
1181+
1182+ @property
1183+ def changes (self ) -> "CommitChanges" :
1184+ """Commit change information."""
1185+ raise NotImplementedError ()
1186+
1187+
11001188class GitTag (OgrAbstractClass ):
11011189 """
11021190 Class representing a git tag.
@@ -1514,6 +1602,16 @@ def default_branch(self) -> str:
15141602 """Default branch (usually `main`, `master` or `trunk`)."""
15151603 raise NotImplementedError ()
15161604
1605+ def get_commit (self , sha : str ) -> "GitCommit" :
1606+ """
1607+ Get a specific commit information.
1608+
1609+ Args:
1610+ sha: Specific sha of the commit
1611+
1612+ """
1613+ raise NotImplementedError ()
1614+
15171615 def get_commits (self , ref : Optional [str ] = None ) -> Union [list [str ], Iterable [str ]]:
15181616 """
15191617 Get list of commits for the project.
0 commit comments