Show More
@@ -58,31 +58,33 def add_renderer_globals(event): | |||||
58 |
|
58 | |||
59 |
|
59 | |||
60 | def auto_merge_pr_if_needed(event): |
|
60 | def auto_merge_pr_if_needed(event): | |
61 | from rhodecode.model.db import PullRequest |
|
61 | #TODO To be re-enabled later | |
62 | from rhodecode.model.pull_request import ( |
|
62 | pass | |
63 | PullRequestModel, ChangesetStatus, MergeCheck |
|
63 | # from rhodecode.model.db import PullRequest | |
64 | ) |
|
64 | # from rhodecode.model.pull_request import ( | |
65 |
|
65 | # PullRequestModel, ChangesetStatus, MergeCheck | ||
66 | pr_event_data = event.as_dict()['pullrequest'] |
|
66 | # ) | |
67 | pull_request = PullRequest.get(pr_event_data['pull_request_id']) |
|
67 | # | |
68 | calculated_status = pr_event_data['status'] |
|
68 | # pr_event_data = event.as_dict()['pullrequest'] | |
69 | if (calculated_status == ChangesetStatus.STATUS_APPROVED |
|
69 | # pull_request = PullRequest.get(pr_event_data['pull_request_id']) | |
70 | and PullRequestModel().is_automatic_merge_enabled(pull_request)): |
|
70 | # calculated_status = pr_event_data['status'] | |
71 | user = pull_request.author.AuthUser() |
|
71 | # if (calculated_status == ChangesetStatus.STATUS_APPROVED | |
72 |
|
72 | # and PullRequestModel().is_automatic_merge_enabled(pull_request)): | ||
73 | merge_check = MergeCheck.validate( |
|
73 | # user = pull_request.author.AuthUser() | |
74 | pull_request, user, translator=lambda x: x, fail_early=True |
|
74 | # | |
75 | ) |
|
75 | # merge_check = MergeCheck.validate( | |
76 | if merge_check.merge_possible: |
|
76 | # pull_request, user, translator=lambda x: x, fail_early=True | |
77 | from rhodecode.lib.base import vcs_operation_context |
|
77 | # ) | |
78 | extras = vcs_operation_context( |
|
78 | # if merge_check.merge_possible: | |
79 | event.request.environ, repo_name=pull_request.target_repo.repo_name, |
|
79 | # from rhodecode.lib.base import vcs_operation_context | |
80 | username=user.username, action='push', |
|
80 | # extras = vcs_operation_context( | |
81 |
|
|
81 | # event.request.environ, repo_name=pull_request.target_repo.repo_name, | |
82 | from rc_ee.lib.celerylib.tasks import auto_merge_repo |
|
82 | # username=user.username, action='push', | |
83 | auto_merge_repo.apply_async( |
|
83 | # scm=pull_request.target_repo.repo_type) | |
84 | args=(pull_request.pull_request_id, extras), countdown=3 |
|
84 | # from rc_ee.lib.celerylib.tasks import auto_merge_repo | |
85 | ) |
|
85 | # auto_merge_repo.apply_async( | |
|
86 | # args=(pull_request.pull_request_id, extras), countdown=3 | |||
|
87 | # ) | |||
86 |
|
88 | |||
87 |
|
89 | |||
88 | def set_user_lang(event): |
|
90 | def set_user_lang(event): |
General Comments 0
You need to be logged in to leave comments.
Login now