Order queue by labels (and their priority)
It often happens that merge team members would like to reorder margebot's queue of MRs to merge, typically becase some MR is more urgent than the others. Currently, the queue is either sorted by the keys created_at
, updated_at
or assigned_at
through the configuration option --merge-order
. That is, either MRs are the oldest MR is merged first, or the least recently updated MR, or the MR to which marge was assigned first.
I propose to:
- Add a new sorting key
label:LABELNAME
.
LABELNAME can either be a normal label (such asdoc
), or a label scope (such aspriority::
ortype::
). Intuitively, this sorts MRs on whether they have the label LABELNAME and for scoped labels, additionally on the labels respective priority in the scope. More formally, two MRs are ordered thus bylabel:LABELNAME
:- If LABELNAME is a normal label:
- MR1 > MR2 if only MR1 has LABELNAME
- MR2 > MR1 if only MR2 has LABELNAME
- MR1 == MR2 if both MR1 & MR2 have LABELNAME or neither has
- If LABELNAME is a label scope:
- MR1 > MR2 if only MR1 has a label from the scope LABELNAME
- MR2 > MR1 if only MR2 has a label from the scope LABELNAME
- if both MR1 and MR2 have a label from the scope LABELNAME, then they are ordered by the respective priorities of the labeles so that the MR with the highest label priority is merged first.
- MR1 == MR2 if neither MR1 & MR2 have a label from the scope LABELNAME
- If LABELNAME is a normal label:
- Let --merge-order take several sort keys. MRs are first sorted by the first key, then the second if they have the same value for the first, etc. For instance, by passing
--merge-order label=priority::,assigned_at
MRs are first ordered by the label scopepriority::
. Then, for MRs with the same priority, MRs are ordered by the time at which they were assigned to marge.
WIP in
Edited by Arvid Jakobsson