To all,
I hope I can get assistance on creating a rule.
I have a new category called "Sanity" such that I do not want it to show on Gerrit UI unless the change branch matches certain 'refs/head/<branch-name>'.
Hence, I defined the category as non-blocking in the project.config of the project not in "All-Projects":
[label "Sanity"]
function = NoBlock
value = -1 Fails
value = 0 No score
value = +1 Passed
And I added the rules.pl for that project as such:
sanity('refs/heads/develop').
submit_rule(S) :-
gerrit:default_submit(In),
In =.. [submit | Ls],
make_sanity_blocking(Ls,R),
S =.. [submit | R].
make_sanity_blocking(S1, S2) :-
gerrit:change_branch(Branch),
sanity(Branch),
!,
rule(-1, 1, 'Sanity', label('Sanity', ST)).
rule(Min, Max, Label, label(Label,S)) :-
gerrit:max_with_block(Label, Min, Max, S).
It does not work. It caused that project to be submittable regardless of the branch without any category shown.
I want to make the "Sanity" category to be blocking only for 'refs/for/develop' and show 'Sanity' category for that branch and do not show it on other branches (i.e. non-blocking).
Any clue?
Thank you.
-Indra
--
--
To unsubscribe, email repo-discuss...@googlegroups.com
More info at http://groups.google.com/group/repo-discuss?hl=en
---
You received this message because you are subscribed to the Google Groups "Repo and Gerrit Discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to repo-discuss...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Thank you for the suggestion. Yes I am running gerrit version 2.8.3. branch key/value pair here : http://review.cyanogenmod.org/Documentation/config-labels.html#label_branch works perfectly.Do you know if the abbreviation key/value pair is honored at all since the table does not show "ST" that I specifically set to in the children project's project.config
It only displays it as "S".Thank you for the suggestion. Yes I am running gerrit version 2.8.3. branch key/value pair here : http://review.cyanogenmod.org/Documentation/config-labels.html#label_branch works perfectly.Do you know if the abbreviation key/value pair is honored at all since the table does not show "ST" that I specifically set to in the children project's project.config (I make it blocking for /refs/heads/develop): Not all projects require sanity as category for now.
[label "Sanity"]
abbreviation = ST
branch = refs/heads/develop
function = MaxWithBlock
value = -1 Fails
value = 0 No score
value = +1 Passed
Can you show me the way to remove_sanity_label and make it removethe Sanity label if the change_branch is not refs/heads/develop? I presume it must be a submit_filter?
Before you suggested the simple solution of "branch" key/value pair I adopted one of the example where in All-Projects' rules.pl I have:
sanity('pi/da_user_web_cache','refs/heads/develop').
submit_filter(In, Out) :-
gerrit:change_branch(Branch),
gerrit:change_project(Project),
sanity(Project, Branch),
!,
In =.. [submit | I],
gerrit:max_with_block(-1, 1, 'Sanity', ST),
Out =.. [submit, ST | I].
submit_filter(In, Out) :- In = Out.
> Can you show me the way to remove_sanity_label and make it remove the Sanity label if the change_branch is not refs/heads/develop?
The easy way is in one of my abandoned change. but no one buy it.
/Bruce