The first example from the Prolog Cookbook doesn't work

113 views
Skip to first unread message

Cezariusz Marek

unread,
Jul 14, 2016, 2:40:05 PM7/14/16
to Repo and Gerrit Discussion
I'm trying to create my own submit filter (to allow submit when there's a +1 CR by non-author, or +2 CR by anyone). It didn't work like expected, so I decided to start over and test all the examples first.

The first example seems simple:
submit_rule(submit(W)) :-
    W
= label('Any-Label-Name', ok(_)).

But when I try to test it, I get the error:
$ cat rules.pl | ssh jerry gerrit test-submit rule -s Ib0228a1d9ae1c8fe82bbbbb4b138a4e285b99130
[
 
{
   
"status": "RULE_ERROR",
   
"error_message": "Submit rule :(user,submit_rule) for change 1750 of parking/mobile output invalid result: submit(label(Any-Label-Name,ok(_4F3706E))). Reason: A label with the status Any-Label-Name: OK must contain a user.",
   
"prolog_reduction_count": 483
 
}
]

What am I doing wrong?

Saša Živkov

unread,
Jul 14, 2016, 4:43:09 PM7/14/16
to Cezariusz Marek, Repo and Gerrit Discussion
At the time when the cookbook was written this example worked.
Some time after that the ok clause was changed to require a user (as the error message says).

To make it work, replace ok(_) with, for example, ok(user(1000000)).
The 1000000 is an account id.


--
--
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.

David Pursehouse

unread,
Jul 15, 2016, 12:13:03 AM7/15/16
to Saša Živkov, Cezariusz Marek, Repo and Gerrit Discussion
On Fri, Jul 15, 2016 at 5:43 AM Saša Živkov <ziv...@gmail.com> wrote:
On Thu, Jul 14, 2016 at 6:05 PM, Cezariusz Marek <cezariu...@gmail.com> wrote:
I'm trying to create my own submit filter (to allow submit when there's a +1 CR by non-author, or +2 CR by anyone). It didn't work like expected, so I decided to start over and test all the examples first.

The first example seems simple:
submit_rule(submit(W)) :-
    W
= label('Any-Label-Name', ok(_)).

But when I try to test it, I get the error:
$ cat rules.pl | ssh jerry gerrit test-submit rule -s Ib0228a1d9ae1c8fe82bbbbb4b138a4e285b99130
[
 
{
   
"status": "RULE_ERROR",
   
"error_message": "Submit rule :(user,submit_rule) for change 1750 of parking/mobile output invalid result: submit(label(Any-Label-Name,ok(_4F3706E))). Reason: A label with the status Any-Label-Name: OK must contain a user.",
   
"prolog_reduction_count": 483
 
}
]

What am I doing wrong?

At the time when the cookbook was written this example worked.
Some time after that the ok clause was changed to require a user (as the error message says).

Then the documentation should also be fixed, because it still says:

 `ok(user(ID))` or just `ok(_)` if user info is not important.

And the same probably applies to the reject clause.

Saša Živkov

unread,
Jul 15, 2016, 5:15:02 AM7/15/16
to David Pursehouse, Cezariusz Marek, Repo and Gerrit Discussion
Yes, it needs to be fixed... it should have been fixed at the moment when
the user in ok became mandatory.
 

And the same probably applies to the reject clause.
I need to check that. 

IIRC, the need(_) is possible without a user.

I will fix the documentation.

Saša Živkov

unread,
Jul 15, 2016, 7:16:33 AM7/15/16
to David Pursehouse, Cezariusz Marek, Repo and Gerrit Discussion
Reply all
Reply to author
Forward
0 new messages