# HG changeset patch # User Martin Bornhold # Date 2016-06-27 11:17:41 # Node ID 813d7f2ffed4c9367c4a909ce5a332f5c50d4bd6 # Parent 978630ac68bb2729a2a9990c9cd3ac6f0a1e6460 settings: Read 'rebase-merge' config option and pass it to the VCS insntacen on merge. diff --git a/rhodecode/model/pull_request.py b/rhodecode/model/pull_request.py --- a/rhodecode/model/pull_request.py +++ b/rhodecode/model/pull_request.py @@ -425,6 +425,7 @@ class PullRequestModel(BaseModel): workspace_id = self._workspace_id(pull_request) protocol = rhodecode.CONFIG.get('vcs.hooks.protocol') use_direct_calls = rhodecode.CONFIG.get('vcs.hooks.direct_calls') + use_rebase = self._use_rebase_for_merging(pull_request) callback_daemon, extras = prepare_callback_daemon( extras, protocol=protocol, use_direct_calls=use_direct_calls) @@ -437,7 +438,7 @@ class PullRequestModel(BaseModel): merge_state = target_vcs.merge( target_ref, source_vcs, pull_request.source_ref_parts, workspace_id, user_name=user.username, - user_email=user.email, message=message) + user_email=user.email, message=message, use_rebase=use_rebase) return merge_state def _comment_and_close_pr(self, pull_request, user, merge_state): @@ -955,9 +956,10 @@ class PullRequestModel(BaseModel): def _refresh_merge_state(self, pull_request, target_vcs, target_reference): workspace_id = self._workspace_id(pull_request) source_vcs = pull_request.source_repo.scm_instance() + use_rebase = self._use_rebase_for_merging(pull_request) merge_state = target_vcs.merge( target_reference, source_vcs, pull_request.source_ref_parts, - workspace_id, dry_run=True) + workspace_id, dry_run=True, use_rebase=use_rebase) # Do not store the response if there was an unknown error. if merge_state.failure_reason != MergeFailureReason.UNKNOWN: @@ -1126,6 +1128,11 @@ class PullRequestModel(BaseModel): settings = settings_model.get_general_settings() return settings.get('rhodecode_pr_merge_enabled', False) + def _use_rebase_for_merging(self, pull_request): + settings_model = VcsSettingsModel(repo=pull_request.target_repo) + settings = settings_model.get_general_settings() + return settings.get('rhodecode_hg_use_rebase_for_merging', False) + def _log_action(self, action, user, pull_request): action_logger( user,