Prior to invoking the submit_rule(X)
query for a change, Gerrit initializes
the Prolog engine with a set of facts (current data) about this change.
The following table provides an overview of the provided facts.
Important
|
All the terms listed below are defined in the gerrit package. To use any
of them we must use a qualified name like gerrit:change_branch(X) .
|
Fact | Example | Description |
---|---|---|
|
|
Destination Branch for the change as string atom |
|
|
Owner of the change as |
|
|
Name of the project as string atom |
|
|
Topic name as string atom |
|
|
Author of the commit as |
|
|
ID, full name and the email of the commit author. The full name and the email are string atoms |
|
|
Committer of the commit as |
|
|
ID, full name and the email of the commit committer. The full name and the email are string atoms |
|
|
Set of votes on the last patch-set |
|
||
|
|
Commit message as string atom |
|
|
Number of files modified, number of insertions and the number of deletions. |
|
|
Current user as one of the four given possibilities |
|
||
|
||
|
||
|
|
Uploader as |
|
|
The number of unresolved comments as an integer atom |
In addition Gerrit provides a set of built-in helper predicates that can be used
when implementing the submit_rule
predicate. The most common ones are listed in
the following table.
Predicate | Example usage | Description |
---|---|---|
|
|
True if any file name from the last patch set matches the given regex. |
|
|
Returns the change type (via Possible values for the change type are the following symbols: |
|
|
Like |
|
|
True if any of the files matched by the file name regex (first parameter)
have edited lines that match the regex in the second parameter. This
example will be true if there is a modification of a |
|
|
True if the commit message matches the given regex. |
Note
|
For a complete list of built-in helpers read the gerrit_common.pl and
all Java classes whose name matches PRED_*.java from Gerrit’s source code.
|
Part of Gerrit Code Review