Requiring two +2s to merge without counting +1s in rules.pl

34 views
Skip to first unread message

Ry Jones

unread,
Aug 23, 2016, 2:21:20 AM8/23/16
to Repo and Gerrit Discussion
I wish to modify the submit rule from https://groups.google.com/forum/#!topic/repo-discuss/Yf9z0WL-FvU to only allow submitting if the score is 4, and I only wish to count +2s. The first part is easy enough:

add_category_min_score(NoCR, 'Code-Review', 4, Labels)

I assume I need to modify sum_list:
sum_list([H | Rest], Sum) :- 
  sum_list(Rest, Tmp), Sum is H + Tmp.

to only count "+2"s.

How do I not count +1s? One option is to not give anyone other than committers the ability to +1 a change, which seems anti-social.
Ry

Saša Živkov

unread,
Aug 23, 2016, 4:03:13 AM8/23/16
to Ry Jones, Repo and Gerrit Discussion
On Mon, Aug 22, 2016 at 10:27 PM, Ry Jones <rjo...@linuxfoundation.org> wrote:
I wish to modify the submit rule from https://groups.google.com/forum/#!topic/repo-discuss/Yf9z0WL-FvU to only allow submitting if the score is 4, and I only wish to count +2s. The first part is easy enough:

add_category_min_score(NoCR, 'Code-Review', 4, Labels)

I assume I need to modify sum_list:
sum_list([H | Rest], Sum) :- 
  sum_list(Rest, Tmp), Sum is H + Tmp.

to only count "+2"s.

sum_list([], 0).

sum_list([2 | Rest], Sum) :-
  sum_list(Rest, Tmp), Sum is 2 + Tmp, !.

sum_list([_ | Rest], Sum) :-
  sum_list(Rest, Sum).
 

How do I not count +1s? One option is to not give anyone other than committers the ability to +1 a change, which seems anti-social.
Ry

--
--
To unsubscribe, email repo-discuss+unsubscribe@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+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Ry Jones

unread,
Aug 23, 2016, 10:54:35 AM8/23/16
to Saša Živkov, Repo and Gerrit Discussion
Perfect, thank you!
Reply all
Reply to author
Forward
0 new messages