submit-requirement: applicableIf, submittableIf, overrideIf as multi-values

2 views
Skip to first unread message

Saša Živkov

unread,
5:19 AM (4 hours ago) 5:19 AM
to Repo and Gerrit Discussion
Since [1] Gerrit rejects multivalued applicableIf, submittableIf, overrideIf for a submit requirement.
IMHO, this wasn't the right decision. It would be better if those options are allowed as multi-valued and if all values are combined with the OR operator. This would also be consistent with other parts of Gerri like label.[name].branch which is allowed to be multivalued.

I came across this after migrating some labels (with functions) to submit requirements.
A label definition specified a lot of branch values:
[label "Foo"]
  branch = refs/heads/test
  branch = refs/heads/master
  branch = refs/heads/stable
  branch = refs/heads/sp1
  branch = refs/heads/sp2
  branch = refs/heads/v1.0
  branch = refs/heads/v2.0
  branch = refs/heads/v2.1
  ...

and this was migrated to:
[submit-requirement "Foo"]
  applicableIf = branch:refs/heads/test OR branch:refs/heads/master OR branch:refs/heads/stable OR branch:refs/heads/sp1 OR branch:refs/heads/sp2 OR branch:refs/heads/v1.0 OR branch:refs/heads/v2.0 OR branch:refs/heads/v2.1 OR ...

which is IMHO less readable and harder to maintain than:
[submit-requirement "Foo"]
  applicableIf = branch:refs/heads/test
  applicableIf = branch:refs/heads/master
  applicableIf = branch:refs/heads/stable
  applicableIf = branch:refs/heads/sp1
  applicableIf = branch:refs/heads/sp2
  applicableIf = branch:refs/heads/v1.0
  applicableIf = branch:refs/heads/v2.0
  applicableIf = branch:refs/heads/v2.1
  ...

While readability is subjective, I don't see why should we prevent multiple [applicable|submittable|overrid]If values. The evaluation is simple: they are just all
combined with the OR operator.

WDYT?

Reply all
Reply to author
Forward
0 new messages