@@ -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,91 @@ 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+ def __init__ (self , raw_changes : Any ) -> None :
1113+ self ._raw_changes = raw_changes
1114+
1115+ @property
1116+ def parent (self ) -> Union ["GitCommit" , "PullRequest" ]:
1117+ """Parent object containing the changes."""
1118+ raise NotImplementedError
1119+
1120+ @property
1121+ def files (self ) -> Union [list [str ], Iterable [str ]]:
1122+ """Files changed by the current change."""
1123+ raise NotImplementedError
1124+
1125+ @property
1126+ def patch (self ) -> bytes :
1127+ """Patch of the changes."""
1128+ raise NotImplementedError
1129+
1130+ @property
1131+ def diff_url (self ) -> str :
1132+ """Web URL to the diff of the pull request."""
1133+ raise NotImplementedError ()
1134+
1135+
1136+ class CommitChanges (CommitLikeChanges ):
1137+ """
1138+ Class representing a Commit's change
1139+
1140+ Attributes:
1141+ commit (GitCommit): Parent commit.
1142+ """
1143+
1144+ def __init__ (self , raw_changes : Any , commit : "GitCommit" ) -> None :
1145+ super ().__init__ (raw_changes = raw_changes )
1146+ self .commit = commit
1147+
1148+ @property
1149+ def parent (self ) -> "GitCommit" :
1150+ return self .commit
1151+
1152+
1153+ class PullRequestChanges (CommitLikeChanges ):
1154+ """
1155+ Class representing a PullRequest's changes
1156+
1157+ Attributes:
1158+ pull_request (PullRequest): Parent pull request.
1159+ """
1160+
1161+ def __init__ (self , raw_changes : Any , pull_request : "PullRequest" ) -> None :
1162+ super ().__init__ (raw_changes = raw_changes )
1163+ self .pull_request = pull_request
1164+
1165+ @property
1166+ def parent (self ) -> "PullRequest" :
1167+ return self .pull_request
1168+
1169+
1170+ class GitCommit (OgrAbstractClass ):
1171+ """
1172+ Class representing a git commit
1173+
1174+ Attributes:
1175+ sha (str): Commit hash.
1176+ project (GitProject): Git project where the commit belongs to.
1177+ """
1178+
1179+ def __init__ (self , sha : str , raw_commit : Any , project : "GitProject" ) -> None :
1180+ self .sha = sha
1181+ self ._raw_commit = raw_commit
1182+ self .project = project
1183+
1184+ @property
1185+ def changes (self ) -> "CommitChanges" :
1186+ """Commit change information."""
1187+ raise NotImplementedError ()
1188+
1189+
11001190class GitTag (OgrAbstractClass ):
11011191 """
11021192 Class representing a git tag.
@@ -1514,6 +1604,16 @@ def default_branch(self) -> str:
15141604 """Default branch (usually `main`, `master` or `trunk`)."""
15151605 raise NotImplementedError ()
15161606
1607+ def get_commit (self , sha : str ) -> "GitCommit" :
1608+ """
1609+ Get a specific commit information.
1610+
1611+ Args:
1612+ sha: Specific sha of the commit
1613+
1614+ """
1615+ raise NotImplementedError ()
1616+
15171617 def get_commits (self , ref : Optional [str ] = None ) -> Union [list [str ], Iterable [str ]]:
15181618 """
15191619 Get list of commits for the project.
0 commit comments