##// END OF EJS Templates
settings: Read 'rebase-merge' config option and pass it to the VCS insntacen on merge.
Martin Bornhold -
r361:813d7f2f default
parent child Browse files
Show More
@@ -425,6 +425,7 b' class PullRequestModel(BaseModel):'
425 workspace_id = self._workspace_id(pull_request)
425 workspace_id = self._workspace_id(pull_request)
426 protocol = rhodecode.CONFIG.get('vcs.hooks.protocol')
426 protocol = rhodecode.CONFIG.get('vcs.hooks.protocol')
427 use_direct_calls = rhodecode.CONFIG.get('vcs.hooks.direct_calls')
427 use_direct_calls = rhodecode.CONFIG.get('vcs.hooks.direct_calls')
428 use_rebase = self._use_rebase_for_merging(pull_request)
428
429
429 callback_daemon, extras = prepare_callback_daemon(
430 callback_daemon, extras = prepare_callback_daemon(
430 extras, protocol=protocol, use_direct_calls=use_direct_calls)
431 extras, protocol=protocol, use_direct_calls=use_direct_calls)
@@ -437,7 +438,7 b' class PullRequestModel(BaseModel):'
437 merge_state = target_vcs.merge(
438 merge_state = target_vcs.merge(
438 target_ref, source_vcs, pull_request.source_ref_parts,
439 target_ref, source_vcs, pull_request.source_ref_parts,
439 workspace_id, user_name=user.username,
440 workspace_id, user_name=user.username,
440 user_email=user.email, message=message)
441 user_email=user.email, message=message, use_rebase=use_rebase)
441 return merge_state
442 return merge_state
442
443
443 def _comment_and_close_pr(self, pull_request, user, merge_state):
444 def _comment_and_close_pr(self, pull_request, user, merge_state):
@@ -955,9 +956,10 b' class PullRequestModel(BaseModel):'
955 def _refresh_merge_state(self, pull_request, target_vcs, target_reference):
956 def _refresh_merge_state(self, pull_request, target_vcs, target_reference):
956 workspace_id = self._workspace_id(pull_request)
957 workspace_id = self._workspace_id(pull_request)
957 source_vcs = pull_request.source_repo.scm_instance()
958 source_vcs = pull_request.source_repo.scm_instance()
959 use_rebase = self._use_rebase_for_merging(pull_request)
958 merge_state = target_vcs.merge(
960 merge_state = target_vcs.merge(
959 target_reference, source_vcs, pull_request.source_ref_parts,
961 target_reference, source_vcs, pull_request.source_ref_parts,
960 workspace_id, dry_run=True)
962 workspace_id, dry_run=True, use_rebase=use_rebase)
961
963
962 # Do not store the response if there was an unknown error.
964 # Do not store the response if there was an unknown error.
963 if merge_state.failure_reason != MergeFailureReason.UNKNOWN:
965 if merge_state.failure_reason != MergeFailureReason.UNKNOWN:
@@ -1126,6 +1128,11 b' class PullRequestModel(BaseModel):'
1126 settings = settings_model.get_general_settings()
1128 settings = settings_model.get_general_settings()
1127 return settings.get('rhodecode_pr_merge_enabled', False)
1129 return settings.get('rhodecode_pr_merge_enabled', False)
1128
1130
1131 def _use_rebase_for_merging(self, pull_request):
1132 settings_model = VcsSettingsModel(repo=pull_request.target_repo)
1133 settings = settings_model.get_general_settings()
1134 return settings.get('rhodecode_hg_use_rebase_for_merging', False)
1135
1129 def _log_action(self, action, user, pull_request):
1136 def _log_action(self, action, user, pull_request):
1130 action_logger(
1137 action_logger(
1131 user,
1138 user,
General Comments 0
You need to be logged in to leave comments. Login now