##// END OF EJS Templates
pull-requests: use merge info to show how Pull requests will be merged....
marcink -
r2053:bad6294f default
parent child Browse files
Show More
@@ -368,6 +368,8 b' class RepoPullRequestsView(RepoAppView, '
368 c.pr_merge_possible = not _merge_check.failed
368 c.pr_merge_possible = not _merge_check.failed
369 c.pr_merge_message = _merge_check.merge_msg
369 c.pr_merge_message = _merge_check.merge_msg
370
370
371 c.pr_merge_info = MergeCheck.get_merge_conditions(pull_request_latest)
372
371 c.pull_request_review_status = _merge_check.review_status
373 c.pull_request_review_status = _merge_check.review_status
372 if merge_checks:
374 if merge_checks:
373 self.request.override_renderer = \
375 self.request.override_renderer = \
@@ -1544,6 +1544,38 b' class MergeCheck(object):'
1544 log.debug('MergeCheck: is failed: %s', merge_check.failed)
1544 log.debug('MergeCheck: is failed: %s', merge_check.failed)
1545 return merge_check
1545 return merge_check
1546
1546
1547 @classmethod
1548 def get_merge_conditions(cls, pull_request):
1549 merge_details = {}
1550
1551 model = PullRequestModel()
1552 use_rebase = model._use_rebase_for_merging(pull_request)
1553
1554 if use_rebase:
1555 merge_details['merge_strategy'] = dict(
1556 details={},
1557 message=_('Merge strategy: rebase')
1558 )
1559 else:
1560 merge_details['merge_strategy'] = dict(
1561 details={},
1562 message=_('Merge strategy: explicit merge commit')
1563 )
1564
1565 close_branch = model._close_branch_before_merging(pull_request)
1566 if close_branch:
1567 repo_type = pull_request.target_repo.repo_type
1568 if repo_type == 'hg':
1569 close_msg = _('Source branch will be closed after merge.')
1570 elif repo_type == 'git':
1571 close_msg = _('Source branch will be deleted after merge.')
1572
1573 merge_details['close_branch'] = dict(
1574 details={},
1575 message=close_msg
1576 )
1577
1578 return merge_details
1547
1579
1548 ChangeTuple = namedtuple('ChangeTuple',
1580 ChangeTuple = namedtuple('ChangeTuple',
1549 ['added', 'common', 'removed', 'total'])
1581 ['added', 'common', 'removed', 'total'])
@@ -1741,10 +1741,14 b' BIN_FILENODE = 7'
1741 }
1741 }
1742
1742
1743 .pull-request-merge-actions {
1743 .pull-request-merge-actions {
1744 height: 30px;
1744 min-height: 30px;
1745 padding: 0px 0px;
1745 padding: 0px 0px;
1746 }
1746 }
1747
1747
1748 .pull-request-merge-info {
1749 padding: 0px 5px 5px 0px;
1750 }
1751
1748 .merge-status {
1752 .merge-status {
1749 margin-right: 5px;
1753 margin-right: 5px;
1750 }
1754 }
@@ -62,6 +62,7 b''
62 .icon-lock:before { content: '\e806'; } /* 'ξ †' */
62 .icon-lock:before { content: '\e806'; } /* 'ξ †' */
63 .icon-unlock:before { content: '\e807'; } /* 'ξ ‡' */
63 .icon-unlock:before { content: '\e807'; } /* 'ξ ‡' */
64 .icon-delete:before { content: '\e808'; } /* '' */
64 .icon-delete:before { content: '\e808'; } /* '' */
65 .icon-false:before { content: '\e808'; } /* '' */
65
66
66 .icon-ok:before { content: '\e809'; } /* 'ξ ‰' */
67 .icon-ok:before { content: '\e809'; } /* 'ξ ‰' */
67 .icon-true:before { content: '\e809'; } /* 'ξ ‰' */
68 .icon-true:before { content: '\e809'; } /* 'ξ ‰' */
@@ -13,6 +13,7 b''
13 </h2>
13 </h2>
14 % endif
14 % endif
15
15
16 % if c.pr_merge_errors.items():
16 <ul>
17 <ul>
17 % for pr_check_key, pr_check_details in c.pr_merge_errors.items():
18 % for pr_check_key, pr_check_details in c.pr_merge_errors.items():
18 <% pr_check_type = pr_check_details['error_type'] %>
19 <% pr_check_type = pr_check_details['error_type'] %>
@@ -28,10 +29,24 b''
28 </li>
29 </li>
29 % endfor
30 % endfor
30 </ul>
31 </ul>
32 % endif
31
33
32 <div class="pull-request-merge-actions">
34 <div class="pull-request-merge-actions">
33 % if c.allowed_to_merge:
35 % if c.allowed_to_merge:
34 <div class="pull-right">
36 ## Merge info, show only if all errors are taken care of
37 % if not c.pr_merge_errors and c.pr_merge_info:
38 <div class="pull-request-merge-info">
39 <ul>
40 % for pr_merge_key, pr_merge_details in c.pr_merge_info.items():
41 <li>
42 - ${pr_merge_details['message']}
43 </li>
44 % endfor
45 </ul>
46 </div>
47 % endif
48
49 <div>
35 ${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)}
50 ${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)}
36 <% merge_disabled = ' disabled' if c.pr_merge_possible is False else '' %>
51 <% merge_disabled = ' disabled' if c.pr_merge_possible is False else '' %>
37 <a class="btn" href="#" onclick="refreshMergeChecks(); return false;">${_('refresh checks')}</a>
52 <a class="btn" href="#" onclick="refreshMergeChecks(); return false;">${_('refresh checks')}</a>
General Comments 0
You need to be logged in to leave comments. Login now