Skip to content

Commit a5aaab4

Browse files
authored
Merge pull request #1 from kennytm/rollup-details
Improve rollup.
2 parents 7dc5d2c + 0cfbe1c commit a5aaab4

File tree

2 files changed

+43
-9
lines changed

2 files changed

+43
-9
lines changed

homu/html/queue.html

Lines changed: 34 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,16 +28,39 @@
2828
#search { width: 150px; }
2929
.hide { display: none; }
3030
th { cursor: pointer; }
31+
#actual-rollup { background: #c7e2ff; border: #00acf7 3px double; border-radius: 5px; width: 75%; padding: 0 1em; }
3132
</style>
3233
</head>
3334
<body>
3435
<h1>Homu queue - {% if repo_url %}<a href="{{repo_url}}" target="_blank">{{repo_label}}</a>{% else %}{{repo_label}}{% endif %} {% if treeclosed %} [TREE CLOSED below priority {{treeclosed}}] {% endif %}</h2>
3536

3637
<p>
37-
<button type="button" id="rollup">Create a rollup</button>
38+
<button type="button" id="expand-rollup">Create a rollup</button>
3839
<button type="button" id="synch">Synchronize</button>
3940
</p>
4041

42+
<div id="actual-rollup" class="hide">
43+
<p>This will create a new pull request consisting of <span id="checkbox-count">0</span> PRs.</p>
44+
<p>A rollup is useful for shortening the queue, but jumping the queue is unfair to older PRs who have waited too long.</p>
45+
<p>When creating a real rollup, try to be fair to the PRs not rolled up. You may pick one of these strategies:</p>
46+
<ul>
47+
<li>
48+
<p>Always include the first <span class="approved">approved</span> PR in the rollup.
49+
Then give the new pull request the highest priority (p=100);</p>
50+
<p><i>or</i></p>
51+
</li>
52+
<li>
53+
<p>After creating the rollup, give it a fairly high priority (p=10), then assign
54+
even higher priorties (p=20, ...) to every PRs older than the oldest rolled up PR.</p>
55+
</li>
56+
</ul>
57+
<p>
58+
<button type="button" id="rollup">Rollup</button>
59+
60+
<button type="button" id="cancel-rollup">Cancel</button>
61+
</p>
62+
</div>
63+
4164
<p>
4265
{{ total }} total, {{ approved }} approved, {{ rolled_up }} rolled up, {{ failed }} failed
4366
/
@@ -91,9 +114,17 @@ <h1>Homu queue - {% if repo_url %}<a href="{{repo_url}}" target="_blank">{{repo_
91114
<script src="//cdn.datatables.net/1.10.4/js/jquery.dataTables.min.js"></script>
92115

93116
<script>
94-
document.getElementById('rollup').onclick = function(ev) {
95-
if (!confirm('This will create a new pull request. Proceed?')) return;
117+
document.getElementById('expand-rollup').onclick = function() {
118+
var checkboxCount = document.querySelectorAll('#queue tbody input[type=checkbox]:checked').length;
119+
document.getElementById('checkbox-count').innerHTML = checkboxCount;
120+
document.getElementById('actual-rollup').className = '';
121+
};
96122

123+
document.getElementById('cancel-rollup').onclick = function() {
124+
document.getElementById('actual-rollup').className = 'hide';
125+
};
126+
127+
document.getElementById('rollup').onclick = function(ev) {
97128
var nums = [];
98129
var els = document.querySelectorAll('#queue tbody input[type=checkbox]:checked');
99130
for (var i=0;i<els.length;i++) {

homu/server.py

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -234,15 +234,18 @@ def rollup(user_gh, state, repo_label, repo_cfg, repo):
234234
if e.code != 409:
235235
raise
236236

237-
failures.append(state.num)
237+
failures.append(state)
238238
else:
239-
successes.append(state.num)
239+
successes.append(state)
240240

241241
title = 'Rollup of {} pull requests'.format(len(successes))
242-
body = '- Successful merges: {}\n- Failed merges: {}'.format(
243-
', '.join('#{}'.format(x) for x in successes),
244-
', '.join('#{}'.format(x) for x in failures),
245-
)
242+
243+
body = 'Successful merges:\n\n'
244+
for x in successes:
245+
body += ' - #{} ({})\n'.format(x.num, x.title)
246+
body += '\nFailed merges:\n\n'
247+
for x in failures:
248+
body += ' - #{} ({})\n'.format(x.num, x.title)
246249

247250
try:
248251
rollup = repo_cfg.get('branch', {}).get('rollup', 'rollup')

0 commit comments

Comments
 (0)