|Custom submit rules in rules.pl||Magnus Bäck||4/13/12 9:45 AM|
I'm looking into customizing the Prolog rules for determining whether a
change can be submitted, but in between the scarce documentation and my
limited Prolog skills, it turned out rather difficult.
I tried putting a rules.pl with simply
in refs/meta/config of my test project and expected all changes to be
submit_rule(P) :- label(_, ok(_)).
instead effectively deleted all approval categories. Not just from the
Can someone please shed some light on this? What's the expected result
|Re: Custom submit rules in rules.pl||Shawn Pearce||4/13/12 10:22 AM|
On Fri, Apr 13, 2012 at 09:45, Magnus Bäck <ba...@google.com> wrote:
Leaving it like this means P is unbound, so we probably should have
> Looking at ChangeControl.java I suspect it's because the
This doesn't work either, as you said. Its functionally the same as
> instead effectively deleted all approval categories. Not just from the
And that is why those got deleted, because label/2 probably failed so
> Can someone please shed some light on this? What's the expected result
The argument of submit_rule is actually an output, it needs to be a
I could have written this as:
Or even as:
But always allowing submit isn't useful, instead we want to also check
% A rejection from any reviewer, blocks submit.
% If a reviewer approved the change, its OK.
% If the change owner marks it To Be Reviewed, OK.
% Permit valid reviewers to set the Code-Review label.
% Permit owners to set the TBR label.
Remember, in Prolog "," works something like "boolean and" and the
|Re: Custom submit rules in rules.pl||Magnus Bäck||4/20/12 11:30 AM|
On Friday, April 13, 2012 at 13:22 EDT,
Shawn Pearce <s...@google.com> wrote:
> The argument of submit_rule is actually an output, it needs to be a
And in this simple case it would also be okay to replace _ with User or
> But always allowing submit isn't useful, instead we want to also check
So, the interpreter will seek matches of max_with_block/4 and find
> % If a reviewer approved the change, its OK.
Okay, looks reasonable.
> % If the change owner marks it To Be Reviewed, OK.
> % Permit valid reviewers to set the Code-Review label.
Would this predicate actually be used with the current Gerrit
> % Permit owners to set the TBR label.
Doesn't this declare that if the current user owns the change,
|Re: Custom submit rules in rules.pl||Anjan Tummalapalli||3/15/15 11:59 PM|
Hi, can someone please help me in writing prolog submit rule as below
- change can be submitted only when non committer approved
- Administrators group can self approve their own code
|Re: Custom submit rules in rules.pl||Bassem Rabil||3/16/15 4:57 AM|
You can use the Gerrit group "Change Owner"  to implement this by denying the change owner to set Code Review labels using your project permissions. You can check this discussion  for more information.
|Re: Custom submit rules in rules.pl||Anjan Tummalapalli||3/17/15 4:43 AM|
Thanks for your quick reply.. Your solution is working for me as expected..