Show More
@@ -221,13 +221,25 b' class ChangesetController(BaseRepoContro' | |||||
221 | for changeset in c.cs_ranges: |
|
221 | for changeset in c.cs_ranges: | |
222 | inlines = [] |
|
222 | inlines = [] | |
223 | if method == 'show': |
|
223 | if method == 'show': | |
224 |
c.statuses.extend([ChangesetStatusModel() |
|
224 | c.statuses.extend([ChangesetStatusModel().get_status( | |
225 |
|
|
225 | c.rhodecode_db_repo.repo_id, changeset.raw_id)]) | |
226 | changeset.raw_id)]) |
|
|||
227 |
|
226 | |||
228 | c.comments.extend(ChangesetCommentsModel()\ |
|
227 | c.comments.extend(ChangesetCommentsModel()\ | |
229 | .get_comments(c.rhodecode_db_repo.repo_id, |
|
228 | .get_comments(c.rhodecode_db_repo.repo_id, | |
230 | revision=changeset.raw_id)) |
|
229 | revision=changeset.raw_id)) | |
|
230 | ||||
|
231 | #comments from PR | |||
|
232 | st = ChangesetStatusModel().get_statuses( | |||
|
233 | c.rhodecode_db_repo.repo_id, changeset.raw_id, | |||
|
234 | with_revisions=True) | |||
|
235 | # from associated statuses, check the pull requests, and | |||
|
236 | # show comments from them | |||
|
237 | ||||
|
238 | prs = set([x.pull_request for x in | |||
|
239 | filter(lambda x: x.pull_request != None, st)]) | |||
|
240 | ||||
|
241 | for pr in prs: | |||
|
242 | c.comments.extend(pr.comments) | |||
231 | inlines = ChangesetCommentsModel()\ |
|
243 | inlines = ChangesetCommentsModel()\ | |
232 | .get_inline_comments(c.rhodecode_db_repo.repo_id, |
|
244 | .get_inline_comments(c.rhodecode_db_repo.repo_id, | |
233 | revision=changeset.raw_id) |
|
245 | revision=changeset.raw_id) | |
@@ -269,6 +281,9 b' class ChangesetController(BaseRepoContro' | |||||
269 | cs_changes[''] = [None, None, None, None, diff, None] |
|
281 | cs_changes[''] = [None, None, None, None, diff, None] | |
270 | c.changes[changeset.raw_id] = cs_changes |
|
282 | c.changes[changeset.raw_id] = cs_changes | |
271 |
|
283 | |||
|
284 | #sort comments by how they were generated | |||
|
285 | c.comments = sorted(c.comments, key=lambda x: x.comment_id) | |||
|
286 | ||||
272 | # count inline comments |
|
287 | # count inline comments | |
273 | for __, lines in c.inline_comments: |
|
288 | for __, lines in c.inline_comments: | |
274 | for comments in lines.values(): |
|
289 | for comments in lines.values(): | |
@@ -342,7 +357,7 b' class ChangesetController(BaseRepoContro' | |||||
342 | ) |
|
357 | ) | |
343 | except StatusChangeOnClosedPullRequestError: |
|
358 | except StatusChangeOnClosedPullRequestError: | |
344 | log.error(traceback.format_exc()) |
|
359 | log.error(traceback.format_exc()) | |
345 | msg = _('Changing status on a changeset associated with' |
|
360 | msg = _('Changing status on a changeset associated with ' | |
346 | 'a closed pull request is not allowed') |
|
361 | 'a closed pull request is not allowed') | |
347 | h.flash(msg, category='warning') |
|
362 | h.flash(msg, category='warning') | |
348 | return redirect(h.url('changeset_home', repo_name=repo_name, |
|
363 | return redirect(h.url('changeset_home', repo_name=repo_name, |
@@ -224,7 +224,6 b' class PullrequestsController(BaseRepoCon' | |||||
224 | h.flash(_('Successfully opened new pull request'), |
|
224 | h.flash(_('Successfully opened new pull request'), | |
225 | category='success') |
|
225 | category='success') | |
226 | except Exception: |
|
226 | except Exception: | |
227 | raise |
|
|||
228 | h.flash(_('Error occurred during sending pull request'), |
|
227 | h.flash(_('Error occurred during sending pull request'), | |
229 | category='error') |
|
228 | category='error') | |
230 | log.error(traceback.format_exc()) |
|
229 | log.error(traceback.format_exc()) |
@@ -89,27 +89,27 b' class ChangesetStatusModel(BaseModel):' | |||||
89 | with_revisions) |
|
89 | with_revisions) | |
90 | return q.all() |
|
90 | return q.all() | |
91 |
|
91 | |||
92 | def get_status(self, repo, revision=None, pull_request=None): |
|
92 | def get_status(self, repo, revision=None, pull_request=None, as_str=True): | |
93 | """ |
|
93 | """ | |
94 | Returns latest status of changeset for given revision or for given |
|
94 | Returns latest status of changeset for given revision or for given | |
95 | pull request. Statuses are versioned inside a table itself and |
|
95 | pull request. Statuses are versioned inside a table itself and | |
96 | version == 0 is always the current one |
|
96 | version == 0 is always the current one | |
97 |
|
97 | |||
98 | :param repo: |
|
98 | :param repo: | |
99 | :type repo: |
|
|||
100 | :param revision: 40char hash or None |
|
99 | :param revision: 40char hash or None | |
101 | :type revision: str |
|
|||
102 | :param pull_request: pull_request reference |
|
100 | :param pull_request: pull_request reference | |
103 | :type: |
|
101 | :param as_str: return status as string not object | |
104 | """ |
|
102 | """ | |
105 | q = self._get_status_query(repo, revision, pull_request) |
|
103 | q = self._get_status_query(repo, revision, pull_request) | |
106 |
|
104 | |||
107 | # need to use first here since there can be multiple statuses |
|
105 | # need to use first here since there can be multiple statuses | |
108 | # returned from pull_request |
|
106 | # returned from pull_request | |
109 | status = q.first() |
|
107 | status = q.first() | |
110 | status = status.status if status else status |
|
108 | if as_str: | |
111 | st = status or ChangesetStatus.DEFAULT |
|
109 | status = status.status if status else status | |
112 | return str(st) |
|
110 | st = status or ChangesetStatus.DEFAULT | |
|
111 | return str(st) | |||
|
112 | return status | |||
113 |
|
113 | |||
114 | def set_status(self, repo, status, user, comment=None, revision=None, |
|
114 | def set_status(self, repo, status, user, comment=None, revision=None, | |
115 | pull_request=None, dont_allow_on_closed_pull_request=False): |
|
115 | pull_request=None, dont_allow_on_closed_pull_request=False): |
@@ -19,6 +19,11 b'' | |||||
19 | <div style="float:left;padding:0px 2px 0px 2px"><span style="font-size: 18px;">›</span></div> |
|
19 | <div style="float:left;padding:0px 2px 0px 2px"><span style="font-size: 18px;">›</span></div> | |
20 | <div title="${_('Changeset status')}" class="changeset-status-lbl"> ${co.status_change[0].status_lbl}</div> |
|
20 | <div title="${_('Changeset status')}" class="changeset-status-lbl"> ${co.status_change[0].status_lbl}</div> | |
21 | <div class="changeset-status-ico"><img src="${h.url(str('/images/icons/flag_status_%s.png' % co.status_change[0].status))}" /></div> |
|
21 | <div class="changeset-status-ico"><img src="${h.url(str('/images/icons/flag_status_%s.png' % co.status_change[0].status))}" /></div> | |
|
22 | <div style="float:left;padding:3px 0px 0px 5px"> <span class=""> | |||
|
23 | %if co.pull_request: | |||
|
24 | <a href="${h.url('pullrequest_show',repo_name=co.pull_request.other_repo.repo_name,pull_request_id=co.pull_request.pull_request_id)}">${_('Status from pull request %s') % co.pull_request.pull_request_id}</a> | |||
|
25 | %endif | |||
|
26 | </span> </div> | |||
22 | </div> |
|
27 | </div> | |
23 | %endif |
|
28 | %endif | |
24 | %if h.HasPermissionAny('hg.admin', 'repository.admin')() or co.author.user_id == c.rhodecode_user.user_id: |
|
29 | %if h.HasPermissionAny('hg.admin', 'repository.admin')() or co.author.user_id == c.rhodecode_user.user_id: |
General Comments 0
You need to be logged in to leave comments.
Login now