Exemple #1
0
 def comment(
     self,
     body: str,
     commit: Optional[str] = None,
     filename: Optional[str] = None,
     row: Optional[int] = None,
 ) -> "PRComment":
     comment = self._raw_pr.notes.create({"body": body})
     return GitlabPRComment(parent=self, raw_comment=comment)
Exemple #2
0
 def pr_comment(
     self,
     pr_id: int,
     body: str,
     commit: str = None,
     filename: str = None,
     row: int = None,
 ) -> PRComment:
     """
     Create comment on an pr.
     """
     pr = self.gitlab_repo.issues.get(pr_id)
     comment = pr.notes.create({"body": body})
     return GitlabPRComment(comment)
Exemple #3
0
 def _get_all_comments(self) -> List[PRComment]:
     return [
         GitlabPRComment(parent=self, raw_comment=raw_comment)
         for raw_comment in self._raw_pr.notes.list(sort="asc")
     ]
Exemple #4
0
 def _get_all_pr_comments(self, pr_id: int) -> List[PRComment]:
     pr = self.gitlab_repo.mergerequests.get(pr_id)
     return [
         GitlabPRComment(raw_comment)
         for raw_comment in pr.notes.list(sort="asc")
     ]
Exemple #5
0
 def get_comment(self, comment_id: int) -> PRComment:
     return GitlabPRComment(self._raw_pr.notes.get(comment_id))