@@ -97,7 +97,7 @@ def project_grant_user_permissions(self, project_key, username, permission):
9797 :param project_key: project key involved
9898 :param username: user name to be granted
9999 :param permission: the project permissions available are 'PROJECT_ADMIN', 'PROJECT_WRITE' and 'PROJECT_READ'
100- :return:
100+ :return:
101101 """
102102 url = 'rest/api/1.0/projects/{project_key}/permissions/users?permission={permission}&name={username}' .format (
103103 project_key = project_key ,
@@ -126,7 +126,7 @@ def project_grant_group_permissions(self, project_key, groupname, permission):
126126 :param project_key: project key involved
127127 :param groupname: group to be granted
128128 :param permission: the project permissions available are 'PROJECT_ADMIN', 'PROJECT_WRITE' and 'PROJECT_READ'
129- :return:
129+ :return:
130130 """
131131 url = 'rest/api/1.0/projects/{project_key}/permissions/groups?permission={permission}&name={groupname}' .format (
132132 project_key = project_key ,
@@ -157,7 +157,7 @@ def repo_grant_user_permissions(self, project_key, repo_key, username, permissio
157157 :param repo_key: repository key involved (slug)
158158 :param username: user name to be granted
159159 :param permission: the repository permissions available are 'REPO_ADMIN', 'REPO_WRITE' and 'REPO_READ'
160- :return:
160+ :return:
161161 """
162162 params = {'permission' : permission ,
163163 'name' : username }
@@ -198,7 +198,7 @@ def repo_grant_group_permissions(self, project_key, repo_key, groupname, permiss
198198 :param repo_key: repository key involved (slug)
199199 :param groupname: group to be granted
200200 :param permission: the repository permissions available are 'REPO_ADMIN', 'REPO_WRITE' and 'REPO_READ'
201- :return:
201+ :return:
202202 """
203203 params = {'permission' : permission ,
204204 'name' : groupname }
@@ -653,20 +653,24 @@ def check_inbox_pull_requests(self, start=0, limit=None, role=None):
653653 url = 'rest/api/1.0/inbox/pull-requests'
654654 return self .get (url , params = params )
655655
656- def add_pull_request_comment (self , project , repository , pull_request_id , text ):
656+ def add_pull_request_comment (self , project , repository , pull_request_id , text , parent_id = None ):
657657 """
658658 Add comment into pull request
659659 :param project:
660660 :param repository:
661661 :param pull_request_id: the ID of the pull request within the repository
662662 :param text comment text
663+ :param parent_id parent comment id
664+
663665 :return:
664666 """
665667 url = 'rest/api/1.0/projects/{project}/repos/{repository}/pull-requests/{pullRequestId}/comments' .format (
666668 project = project ,
667669 repository = repository ,
668670 pullRequestId = pull_request_id )
669671 body = {'text' : text }
672+ if parent_id :
673+ body ['parent' ] = {'id' : parent_id }
670674 return self .post (url , data = body )
671675
672676 def get_pull_request_comment (self , project , repository , pull_request_id , comment_id ):
@@ -688,6 +692,24 @@ def get_pull_request_comment(self, project, repository, pull_request_id, comment
688692 comment_id = comment_id )
689693 return self .get (url )
690694
695+ def update_pull_request_comment (self , project , repository , pull_request_id , comment_id , comment , comment_version ):
696+ """
697+ Update the text of a comment.
698+ Only the user who created a comment may update it.
699+
700+ Note: the supplied supplied JSON object must contain a version
701+ that must match the server's version of the comment
702+ or the update will fail.
703+ """
704+ url = "/rest/api/1.0/projects/{project}/repos/{repository}/pull-requests/{pull_request_id}/comments/{comment_id}" .format (
705+ project = project , repository = repository , pull_request_id = pull_request_id , comment_id = comment_id
706+ )
707+ payload = {
708+ "version" : comment_version ,
709+ "text" : comment
710+ }
711+ return self .put (url , data = payload )
712+
691713 def get_pullrequest (self , project , repository , pull_request_id ):
692714 """
693715 Retrieve a pull request.
@@ -706,8 +728,8 @@ def get_pullrequest(self, project, repository, pull_request_id):
706728
707729 def change_reviewed_status (self , projectKey , repositorySlug , pullRequestId , status , userSlug ):
708730 """
709- Change the current user's status for a pull request.
710- Implicitly adds the user as a participant if they are not already.
731+ Change the current user's status for a pull request.
732+ Implicitly adds the user as a participant if they are not already.
711733 If the current user is the author, this method will fail.
712734 :param projectKey:
713735 :param repositorySlug:
0 commit comments