rules.pl: refuse to submit commits that says DRAFT or DO NOT SUBMIT
diff --git a/rules.pl b/rules.pl new file mode 100644 index 0000000..fd901e9 --- /dev/null +++ b/rules.pl
@@ -0,0 +1,18 @@ +% We don't send email if the commit message says DRAFT, so don't allow submit either. +submit_filter(In, Out) :- + In =.. [submit | I], + gerrit:commit_message_matches('DRAFT'), + !, + Error = label('Cannot-Submit-DRAFT-Commit', need(_)), + Out =.. [submit, Error | I]. + +% Don't allow submit of DO NOT SUBMIT commit message either. +submit_filter(In, Out) :- + In =.. [submit | I], + gerrit:commit_message_matches('DO NOT SUBMIT'), + !, + Error = label('Cannot-Submit-DO-NOT-SUBMIT-Commit', need(_)), + Out =.. [submit, Error | I]. + +% Otherwise, pass submit rule through. +submit_filter(In, Out) :- In = Out.