# HG changeset patch # User Marcin Kuzminski # Date 2017-08-23 11:48:10 # Node ID bad6294fa3742def5e96b09cfaafca895b7726be # Parent 7fd6e6f2164fe7a3f4465619068ab85f16245763 pull-requests: use merge info to show how Pull requests will be merged. - rebase or merge commit is shown as merge strategy. - close/delete branch are shown if that option is selected. diff --git a/rhodecode/apps/repository/views/repo_pull_requests.py b/rhodecode/apps/repository/views/repo_pull_requests.py --- a/rhodecode/apps/repository/views/repo_pull_requests.py +++ b/rhodecode/apps/repository/views/repo_pull_requests.py @@ -368,6 +368,8 @@ class RepoPullRequestsView(RepoAppView, c.pr_merge_possible = not _merge_check.failed c.pr_merge_message = _merge_check.merge_msg + c.pr_merge_info = MergeCheck.get_merge_conditions(pull_request_latest) + c.pull_request_review_status = _merge_check.review_status if merge_checks: self.request.override_renderer = \ 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 @@ -1544,6 +1544,38 @@ class MergeCheck(object): log.debug('MergeCheck: is failed: %s', merge_check.failed) return merge_check + @classmethod + def get_merge_conditions(cls, pull_request): + merge_details = {} + + model = PullRequestModel() + use_rebase = model._use_rebase_for_merging(pull_request) + + if use_rebase: + merge_details['merge_strategy'] = dict( + details={}, + message=_('Merge strategy: rebase') + ) + else: + merge_details['merge_strategy'] = dict( + details={}, + message=_('Merge strategy: explicit merge commit') + ) + + close_branch = model._close_branch_before_merging(pull_request) + if close_branch: + repo_type = pull_request.target_repo.repo_type + if repo_type == 'hg': + close_msg = _('Source branch will be closed after merge.') + elif repo_type == 'git': + close_msg = _('Source branch will be deleted after merge.') + + merge_details['close_branch'] = dict( + details={}, + message=close_msg + ) + + return merge_details ChangeTuple = namedtuple('ChangeTuple', ['added', 'common', 'removed', 'total']) diff --git a/rhodecode/public/css/main.less b/rhodecode/public/css/main.less --- a/rhodecode/public/css/main.less +++ b/rhodecode/public/css/main.less @@ -1741,10 +1741,14 @@ BIN_FILENODE = 7 } .pull-request-merge-actions { - height: 30px; + min-height: 30px; padding: 0px 0px; } +.pull-request-merge-info { + padding: 0px 5px 5px 0px; +} + .merge-status { margin-right: 5px; } diff --git a/rhodecode/public/css/rcicons.less b/rhodecode/public/css/rcicons.less --- a/rhodecode/public/css/rcicons.less +++ b/rhodecode/public/css/rcicons.less @@ -62,6 +62,7 @@ .icon-lock:before { content: '\e806'; } /* '' */ .icon-unlock:before { content: '\e807'; } /* '' */ .icon-delete:before { content: '\e808'; } /* '' */ +.icon-false:before { content: '\e808'; } /* '' */ .icon-ok:before { content: '\e809'; } /* '' */ .icon-true:before { content: '\e809'; } /* '' */ diff --git a/rhodecode/templates/pullrequests/pullrequest_merge_checks.mako b/rhodecode/templates/pullrequests/pullrequest_merge_checks.mako --- a/rhodecode/templates/pullrequests/pullrequest_merge_checks.mako +++ b/rhodecode/templates/pullrequests/pullrequest_merge_checks.mako @@ -13,6 +13,7 @@ % endif + % if c.pr_merge_errors.items(): + % endif
% if c.allowed_to_merge: -
+ ## Merge info, show only if all errors are taken care of + % if not c.pr_merge_errors and c.pr_merge_info: +
+
    + % for pr_merge_key, pr_merge_details in c.pr_merge_info.items(): +
  • + - ${pr_merge_details['message']} +
  • + % endfor +
+
+ % endif + +
${h.secure_form(h.route_path('pullrequest_merge', repo_name=c.repo_name, pull_request_id=c.pull_request.pull_request_id), id='merge_pull_request_form', method='POST', request=request)} <% merge_disabled = ' disabled' if c.pr_merge_possible is False else '' %> ${_('refresh checks')}