1

I'm not familiar with prolog, but I tried to understand the examples I copied from the Gerrit Prolog Cookbook.

I added a NoOp label Ticket-Checked with three states -1, 0, 1. The label must be +1 if the commit message matches a regex for submitting. If not contained in the commit message, gerrit should simply ignore the flag.

submit_rule(S) :-
  gerrit:default_submit(X), % get the current submit structure
  X=.. [submit | Ls],
  require_ticket_check_for_ticket(Ls, Nls),
  S=.. [submit | Nls].

require_ticket_check_for_ticket(S1, S2) :-
   gerrit:commit_message_matches("\\[Issue-[l-9][0-9]*\\]"), !,
   S2 = [label('Ticket-Checked', need(_)) | S1]. % Add the label 

require_ticket_check_for_ticket(S1, S2) :-
   !, S2 = S1.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.