|
@@
-265,7
+265,7
b' class RepoPullRequestsView(RepoAppView, '
|
|
265
|
route_name='pullrequest_show', request_method='GET',
|
|
265
|
route_name='pullrequest_show', request_method='GET',
|
|
266
|
renderer='rhodecode:templates/pullrequests/pullrequest_show.mako')
|
|
266
|
renderer='rhodecode:templates/pullrequests/pullrequest_show.mako')
|
|
267
|
def pull_request_show(self):
|
|
267
|
def pull_request_show(self):
|
|
268
|
pull_request_id = self.request.matchdict.get('pull_request_id')
|
|
268
|
pull_request_id = self.request.matchdict['pull_request_id']
|
|
269
|
|
|
269
|
|
|
270
|
c = self.load_default_context()
|
|
270
|
c = self.load_default_context()
|
|
271
|
|
|
271
|
|
|
@@
-832,8
+832,8
b' class RepoPullRequestsView(RepoAppView, '
|
|
832
|
route_name='pullrequest_update', request_method='POST',
|
|
832
|
route_name='pullrequest_update', request_method='POST',
|
|
833
|
renderer='json_ext')
|
|
833
|
renderer='json_ext')
|
|
834
|
def pull_request_update(self):
|
|
834
|
def pull_request_update(self):
|
|
835
|
pull_request_id = self.request.matchdict['pull_request_id']
|
|
835
|
pull_request = PullRequest.get_or_404(
|
|
836
|
pull_request = PullRequest.get_or_404(pull_request_id)
|
|
836
|
self.request.matchdict['pull_request_id'])
|
|
837
|
|
|
837
|
|
|
838
|
# only owner or admin can update it
|
|
838
|
# only owner or admin can update it
|
|
839
|
allowed_to_update = PullRequestModel().check_user_update(
|
|
839
|
allowed_to_update = PullRequestModel().check_user_update(
|
|
@@
-843,7
+843,7
b' class RepoPullRequestsView(RepoAppView, '
|
|
843
|
|
|
843
|
|
|
844
|
if 'review_members' in controls:
|
|
844
|
if 'review_members' in controls:
|
|
845
|
self._update_reviewers(
|
|
845
|
self._update_reviewers(
|
|
846
|
pull_request_id, controls['review_members'],
|
|
846
|
pull_request, controls['review_members'],
|
|
847
|
pull_request.reviewer_data)
|
|
847
|
pull_request.reviewer_data)
|
|
848
|
elif str2bool(self.request.POST.get('update_commits', 'false')):
|
|
848
|
elif str2bool(self.request.POST.get('update_commits', 'false')):
|
|
849
|
self._update_commits(pull_request)
|
|
849
|
self._update_commits(pull_request)
|
|
@@
-930,8
+930,8
b' class RepoPullRequestsView(RepoAppView, '
|
|
930
|
After successful merging, the pull request is automatically
|
|
930
|
After successful merging, the pull request is automatically
|
|
931
|
closed, with a relevant comment.
|
|
931
|
closed, with a relevant comment.
|
|
932
|
"""
|
|
932
|
"""
|
|
933
|
pull_request_id = self.request.matchdict['pull_request_id']
|
|
933
|
pull_request = PullRequest.get_or_404(
|
|
934
|
pull_request = PullRequest.get_or_404(pull_request_id)
|
|
934
|
self.request.matchdict['pull_request_id'])
|
|
935
|
|
|
935
|
|
|
936
|
check = MergeCheck.validate(pull_request, self._rhodecode_db_user)
|
|
936
|
check = MergeCheck.validate(pull_request, self._rhodecode_db_user)
|
|
937
|
merge_possible = not check.failed
|
|
937
|
merge_possible = not check.failed
|
|
@@
-974,7
+974,7
b' class RepoPullRequestsView(RepoAppView, '
|
|
974
|
merge_resp.failure_reason)
|
|
974
|
merge_resp.failure_reason)
|
|
975
|
h.flash(msg, category='error')
|
|
975
|
h.flash(msg, category='error')
|
|
976
|
|
|
976
|
|
|
977
|
def _update_reviewers(self, pull_request_id, review_members, reviewer_rules):
|
|
977
|
def _update_reviewers(self, pull_request, review_members, reviewer_rules):
|
|
978
|
_ = self.request.translate
|
|
978
|
_ = self.request.translate
|
|
979
|
get_default_reviewers_data, validate_default_reviewers = \
|
|
979
|
get_default_reviewers_data, validate_default_reviewers = \
|
|
980
|
PullRequestModel().get_reviewer_functions()
|
|
980
|
PullRequestModel().get_reviewer_functions()
|
|
@@
-987,7
+987,7
b' class RepoPullRequestsView(RepoAppView, '
|
|
987
|
return
|
|
987
|
return
|
|
988
|
|
|
988
|
|
|
989
|
PullRequestModel().update_reviewers(
|
|
989
|
PullRequestModel().update_reviewers(
|
|
990
|
pull_request_id, reviewers, self._rhodecode_user)
|
|
990
|
pull_request, reviewers, self._rhodecode_user)
|
|
991
|
h.flash(_('Pull request reviewers updated.'), category='success')
|
|
991
|
h.flash(_('Pull request reviewers updated.'), category='success')
|
|
992
|
Session().commit()
|
|
992
|
Session().commit()
|
|
993
|
|
|
993
|
|
|
@@
-1002,8
+1002,8
b' class RepoPullRequestsView(RepoAppView, '
|
|
1002
|
def pull_request_delete(self):
|
|
1002
|
def pull_request_delete(self):
|
|
1003
|
_ = self.request.translate
|
|
1003
|
_ = self.request.translate
|
|
1004
|
|
|
1004
|
|
|
1005
|
pull_request_id = self.request.matchdict['pull_request_id']
|
|
1005
|
pull_request = PullRequest.get_or_404(
|
|
1006
|
pull_request = PullRequest.get_or_404(pull_request_id)
|
|
1006
|
self.request.matchdict['pull_request_id'])
|
|
1007
|
|
|
1007
|
|
|
1008
|
pr_closed = pull_request.is_closed()
|
|
1008
|
pr_closed = pull_request.is_closed()
|
|
1009
|
allowed_to_delete = PullRequestModel().check_user_delete(
|
|
1009
|
allowed_to_delete = PullRequestModel().check_user_delete(
|
|
@@
-1031,8
+1031,11
b' class RepoPullRequestsView(RepoAppView, '
|
|
1031
|
renderer='json_ext')
|
|
1031
|
renderer='json_ext')
|
|
1032
|
def pull_request_comment_create(self):
|
|
1032
|
def pull_request_comment_create(self):
|
|
1033
|
_ = self.request.translate
|
|
1033
|
_ = self.request.translate
|
|
1034
|
pull_request_id = self.request.matchdict['pull_request_id']
|
|
1034
|
|
|
1035
|
pull_request = PullRequest.get_or_404(pull_request_id)
|
|
1035
|
pull_request = PullRequest.get_or_404(
|
|
|
|
|
1036
|
self.request.matchdict['pull_request_id'])
|
|
|
|
|
1037
|
pull_request_id = pull_request.pull_request_id
|
|
|
|
|
1038
|
|
|
1036
|
if pull_request.is_closed():
|
|
1039
|
if pull_request.is_closed():
|
|
1037
|
log.debug('comment: forbidden because pull request is closed')
|
|
1040
|
log.debug('comment: forbidden because pull request is closed')
|
|
1038
|
raise HTTPForbidden()
|
|
1041
|
raise HTTPForbidden()
|
|
@@
-1080,7
+1083,7
b' class RepoPullRequestsView(RepoAppView, '
|
|
1080
|
text=text,
|
|
1083
|
text=text,
|
|
1081
|
repo=self.db_repo.repo_id,
|
|
1084
|
repo=self.db_repo.repo_id,
|
|
1082
|
user=self._rhodecode_user.user_id,
|
|
1085
|
user=self._rhodecode_user.user_id,
|
|
1083
|
pull_request=pull_request_id,
|
|
1086
|
pull_request=pull_request,
|
|
1084
|
f_path=self.request.POST.get('f_path'),
|
|
1087
|
f_path=self.request.POST.get('f_path'),
|
|
1085
|
line_no=self.request.POST.get('line'),
|
|
1088
|
line_no=self.request.POST.get('line'),
|
|
1086
|
status_change=(ChangesetStatus.get_status_lbl(status)
|
|
1089
|
status_change=(ChangesetStatus.get_status_lbl(status)
|
|
@@
-1102,7
+1105,7
b' class RepoPullRequestsView(RepoAppView, '
|
|
1102
|
status,
|
|
1105
|
status,
|
|
1103
|
self._rhodecode_user.user_id,
|
|
1106
|
self._rhodecode_user.user_id,
|
|
1104
|
comment,
|
|
1107
|
comment,
|
|
1105
|
pull_request=pull_request_id
|
|
1108
|
pull_request=pull_request
|
|
1106
|
)
|
|
1109
|
)
|
|
1107
|
|
|
1110
|
|
|
1108
|
Session().flush()
|
|
1111
|
Session().flush()
|
|
@@
-1142,15
+1145,17
b' class RepoPullRequestsView(RepoAppView, '
|
|
1142
|
route_name='pullrequest_comment_delete', request_method='POST',
|
|
1145
|
route_name='pullrequest_comment_delete', request_method='POST',
|
|
1143
|
renderer='json_ext')
|
|
1146
|
renderer='json_ext')
|
|
1144
|
def pull_request_comment_delete(self):
|
|
1147
|
def pull_request_comment_delete(self):
|
|
1145
|
pull_request_id = self.request.matchdict['pull_request_id']
|
|
1148
|
pull_request = PullRequest.get_or_404(
|
|
1146
|
comment_id = self.request.matchdict['comment_id']
|
|
1149
|
self.request.matchdict['pull_request_id'])
|
|
1147
|
|
|
1150
|
|
|
1148
|
pull_request = PullRequest.get_or_404(pull_request_id)
|
|
1151
|
comment = ChangesetComment.get_or_404(
|
|
|
|
|
1152
|
self.request.matchdict['comment_id'])
|
|
|
|
|
1153
|
comment_id = comment.comment_id
|
|
|
|
|
1154
|
|
|
1149
|
if pull_request.is_closed():
|
|
1155
|
if pull_request.is_closed():
|
|
1150
|
log.debug('comment: forbidden because pull request is closed')
|
|
1156
|
log.debug('comment: forbidden because pull request is closed')
|
|
1151
|
raise HTTPForbidden()
|
|
1157
|
raise HTTPForbidden()
|
|
1152
|
|
|
1158
|
|
|
1153
|
comment = ChangesetComment.get_or_404(comment_id)
|
|
|
|
|
1154
|
if not comment:
|
|
1159
|
if not comment:
|
|
1155
|
log.debug('Comment with id:%s not found, skipping', comment_id)
|
|
1160
|
log.debug('Comment with id:%s not found, skipping', comment_id)
|
|
1156
|
# comment already deleted in another call probably
|
|
1161
|
# comment already deleted in another call probably
|