Skip to content

Make it possible to specify several merge order keys, including label

Arvid Jakobsson requested to merge arvid@mr-labels into master

An easier version of #4 (closed) where priorities are not taken into account.

This MR implements point 2 of #4 (closed) (that is, "Let --merge-order take several sort keys") and a simplified version of point 1 disregarding scoped labels and priorities. That is:

  1. Add a new sorting key label:LABELNAME.
    Intuitively, this sorts MRs on whether they have the label LABELNAME. More formally, two MRs are ordered thus by label:LABELNAME:
    • 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
  2. 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=urgent,assigned_at MRs are first ordered on whether they have the label urgent. Then, for MRs with the label urgent, MRs are ordered by the time at which they were assigned to marge.

Deploying

To use this feature, suffice to pass --merge-order label=LABELNAME,created_at, or set it through the configuration file. For instance, setting merge-order: label=marge-urgent,assigned_at here.

Additional testing

In addition to the unit/integration tests in the MR, i've run the following tests scenarios. I hope they are sufficiently self-explanatory:

Test MR1 created earlier than MR2: --merge-order created_at

Test MR2 updated earlier than MR1: --merge-order updated_at

Test MR1 created earlier than MR2: --merge-order created_at,updated_at

Test MR2 updated earlier than MR1: --merge-order updated_at,created_at

Test MR1 has no label, MR2 is labelled foobar: --merge-order label=foobar,created_at

Test MR1 and MR2 are labelled foobar: --merge-order label=foobar,created_at

Edited by Arvid Jakobsson

Merge request reports