Show More
@@ -201,29 +201,6 b' class RepoPullRequestsView(RepoAppView, ' | |||||
201 |
|
201 | |||
202 | return data |
|
202 | return data | |
203 |
|
203 | |||
204 | def _get_pr_version(self, pull_request_id, version=None): |
|
|||
205 | at_version = None |
|
|||
206 |
|
||||
207 | if version and version == 'latest': |
|
|||
208 | pull_request_ver = PullRequest.get(pull_request_id) |
|
|||
209 | pull_request_obj = pull_request_ver |
|
|||
210 | _org_pull_request_obj = pull_request_obj |
|
|||
211 | at_version = 'latest' |
|
|||
212 | elif version: |
|
|||
213 | pull_request_ver = PullRequestVersion.get_or_404(version) |
|
|||
214 | pull_request_obj = pull_request_ver |
|
|||
215 | _org_pull_request_obj = pull_request_ver.pull_request |
|
|||
216 | at_version = pull_request_ver.pull_request_version_id |
|
|||
217 | else: |
|
|||
218 | _org_pull_request_obj = pull_request_obj = PullRequest.get_or_404( |
|
|||
219 | pull_request_id) |
|
|||
220 |
|
||||
221 | pull_request_display_obj = PullRequest.get_pr_display_object( |
|
|||
222 | pull_request_obj, _org_pull_request_obj) |
|
|||
223 |
|
||||
224 | return _org_pull_request_obj, pull_request_obj, \ |
|
|||
225 | pull_request_display_obj, at_version |
|
|||
226 |
|
||||
227 | def _get_diffset(self, source_repo_name, source_repo, |
|
204 | def _get_diffset(self, source_repo_name, source_repo, | |
228 | source_ref_id, target_ref_id, |
|
205 | source_ref_id, target_ref_id, | |
229 | target_commit, source_commit, diff_limit, fulldiff, |
|
206 | target_commit, source_commit, diff_limit, fulldiff, | |
@@ -278,7 +255,7 b' class RepoPullRequestsView(RepoAppView, ' | |||||
278 | (pull_request_latest, |
|
255 | (pull_request_latest, | |
279 | pull_request_at_ver, |
|
256 | pull_request_at_ver, | |
280 | pull_request_display_obj, |
|
257 | pull_request_display_obj, | |
281 |
at_version) = |
|
258 | at_version) = PullRequestModel().get_pr_version( | |
282 | pull_request_id, version=version) |
|
259 | pull_request_id, version=version) | |
283 | pr_closed = pull_request_latest.is_closed() |
|
260 | pr_closed = pull_request_latest.is_closed() | |
284 |
|
261 | |||
@@ -300,7 +277,7 b' class RepoPullRequestsView(RepoAppView, ' | |||||
300 | (prev_pull_request_latest, |
|
277 | (prev_pull_request_latest, | |
301 | prev_pull_request_at_ver, |
|
278 | prev_pull_request_at_ver, | |
302 | prev_pull_request_display_obj, |
|
279 | prev_pull_request_display_obj, | |
303 |
prev_at_version) = |
|
280 | prev_at_version) = PullRequestModel().get_pr_version( | |
304 | pull_request_id, version=from_version) |
|
281 | pull_request_id, version=from_version) | |
305 |
|
282 | |||
306 | c.from_version = prev_at_version |
|
283 | c.from_version = prev_at_version |
@@ -419,6 +419,29 b' class PullRequestModel(BaseModel):' | |||||
419 | .order_by(PullRequestVersion.pull_request_version_id.asc())\ |
|
419 | .order_by(PullRequestVersion.pull_request_version_id.asc())\ | |
420 | .all() |
|
420 | .all() | |
421 |
|
421 | |||
|
422 | def get_pr_version(self, pull_request_id, version=None): | |||
|
423 | at_version = None | |||
|
424 | ||||
|
425 | if version and version == 'latest': | |||
|
426 | pull_request_ver = PullRequest.get(pull_request_id) | |||
|
427 | pull_request_obj = pull_request_ver | |||
|
428 | _org_pull_request_obj = pull_request_obj | |||
|
429 | at_version = 'latest' | |||
|
430 | elif version: | |||
|
431 | pull_request_ver = PullRequestVersion.get_or_404(version) | |||
|
432 | pull_request_obj = pull_request_ver | |||
|
433 | _org_pull_request_obj = pull_request_ver.pull_request | |||
|
434 | at_version = pull_request_ver.pull_request_version_id | |||
|
435 | else: | |||
|
436 | _org_pull_request_obj = pull_request_obj = PullRequest.get_or_404( | |||
|
437 | pull_request_id) | |||
|
438 | ||||
|
439 | pull_request_display_obj = PullRequest.get_pr_display_object( | |||
|
440 | pull_request_obj, _org_pull_request_obj) | |||
|
441 | ||||
|
442 | return _org_pull_request_obj, pull_request_obj, \ | |||
|
443 | pull_request_display_obj, at_version | |||
|
444 | ||||
422 | def create(self, created_by, source_repo, source_ref, target_repo, |
|
445 | def create(self, created_by, source_repo, source_ref, target_repo, | |
423 | target_ref, revisions, reviewers, title, description=None, |
|
446 | target_ref, revisions, reviewers, title, description=None, | |
424 | reviewer_data=None, translator=None): |
|
447 | reviewer_data=None, translator=None): |
General Comments 0
You need to be logged in to leave comments.
Login now