Skip to content

Commit ae42677

Browse files
authored
Merge pull request #24 from kennytm/rollup-never
Support rollup=never
2 parents 7bb21f2 + 3bf91f6 commit ae42677

File tree

3 files changed

+26
-9
lines changed

3 files changed

+26
-9
lines changed

homu/html/queue.html

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@
1919
.pending { background-color: #F0DE57; }
2020
.approved { background-color: #85DB7B; }
2121

22-
.yes { color: green; }
23-
.no { color: red; }
22+
.yes, .rollup_always { color: green; }
23+
.no, .rollup_never { color: red; }
2424

2525
.sorting_asc:after { content: " ▲"; }
2626
.sorting_desc:after { content: " ▼"; }
@@ -86,6 +86,7 @@ <h1>Homu queue - {% if repo_url %}<a href="{{repo_url}}" target="_blank">{{repo_
8686
<th>Assignee</th>
8787
<th>Approved by</th>
8888
<th>Priority</th>
89+
<th>Rollup</th>
8990
</tr>
9091
</thead>
9192

@@ -111,6 +112,7 @@ <h1>Homu queue - {% if repo_url %}<a href="{{repo_url}}" target="_blank">{{repo_
111112
<td>{{state.assignee}}</td>
112113
<td>{{state.approved_by}}</td>
113114
<td>{{state.priority}}</td>
115+
<td class="rollup_{{state.rollup}}">{{state.rollup}}</td>
114116
</tr>
115117
{% endfor %}
116118
</tbody>

homu/main.py

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,14 @@
4141

4242
global_cfg = {}
4343

44+
WORDS_TO_ROLLUP = {
45+
'rollup-': 0,
46+
'rollup': 1,
47+
'rollup=maybe': 0,
48+
'rollup=never': -1,
49+
'rollup=always': 1,
50+
}
51+
4452

4553
@contextmanager
4654
def buildbot_sess(repo_cfg):
@@ -109,7 +117,7 @@ def __lt__(self, other):
109117
class PullReqState:
110118
num = 0
111119
priority = 0
112-
rollup = False
120+
rollup = 0
113121
title = ''
114122
body = ''
115123
head_ref = ''
@@ -165,7 +173,7 @@ def sort_key(self):
165173
STATUS_TO_PRIORITY.get(self.get_status(), -1),
166174
1 if self.mergeable is False else 0,
167175
0 if self.approved_by else 1,
168-
1 if self.rollup else 0,
176+
self.rollup,
169177
-self.priority,
170178
self.num,
171179
]
@@ -645,10 +653,10 @@ def parse_commands(body, username, repo_label, repo_cfg, state, my_username,
645653
# any meaningful labeling events.
646654
state.change_labels(LabelEvent.TRY)
647655

648-
elif word in ['rollup', 'rollup-']:
656+
elif word in WORDS_TO_ROLLUP:
649657
if not _try_auth_verified():
650658
continue
651-
state.rollup = word == 'rollup'
659+
state.rollup = WORDS_TO_ROLLUP[word]
652660

653661
state.save()
654662

@@ -1653,7 +1661,7 @@ def main():
16531661
state.approved_by = approved_by
16541662
state.priority = int(priority)
16551663
state.try_ = bool(try_)
1656-
state.rollup = bool(rollup)
1664+
state.rollup = rollup
16571665
state.delegate = delegate
16581666
builders = []
16591667
if merge_sha:

homu/server.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,12 @@ class G:
4343

4444
g = G()
4545

46+
ROLLUP_STR = {
47+
-1: 'never',
48+
0: '',
49+
1: 'always',
50+
}
51+
4652

4753
def find_state(sha):
4854
for repo_label, repo_states in g.states.items():
@@ -145,7 +151,8 @@ def queue(repo_label):
145151
rows.append({
146152
'status': state.get_status(),
147153
'status_ext': status_ext,
148-
'priority': 'rollup' if state.rollup else state.priority,
154+
'priority': state.priority,
155+
'rollup': ROLLUP_STR.get(state.rollup, ''),
149156
'url': 'https://github.com/{}/{}/pull/{}'.format(state.owner,
150157
state.name,
151158
state.num),
@@ -170,7 +177,7 @@ def queue(repo_label):
170177
oauth_client_id=g.cfg['github']['app_client_id'],
171178
total=len(pull_states),
172179
approved=len([x for x in pull_states if x.approved_by]),
173-
rolled_up=len([x for x in pull_states if x.rollup]),
180+
rolled_up=len([x for x in pull_states if x.rollup > 0]),
174181
failed=len([x for x in pull_states if x.status == 'failure' or
175182
x.status == 'error']),
176183
multiple=multiple,

0 commit comments

Comments
 (0)