gerrit/Documentation/cmd-test-submit-rule.txt
Johan Björk 20ae0696b3 Add ssh command "test-submit-rule"
The command creates a fresh prolog environment and loads a prolog script
either from stdin or rules.pl in the project refs/meta/config branch
depending on the options used.
can_submit/1 is then queried and the results are returned in human
readable text or json.

Change-Id: I246a89f9f35718320b69ec43ddf11fbe002ed566
2012-10-05 11:33:17 -04:00

94 lines
2.2 KiB
Plaintext

gerrit test-submit-rule
=======================
NAME
----
gerrit test-submit-rule - Test prolog submit rules with a chosen changeset.
SYNOPSIS
--------
[verse]
'ssh' -p <port> <host> 'gerrit test-submit-rule'
[-s]
[--no-filters]
[--format {TEXT | JSON}]
CHANGE
DESCRIPTION
-----------
Provides a way to test prolog link:prolog-cookbook.html[submit rules].
OPTIONS
-------
-s::
Reads a rules.pl file from stdin instead of rules.pl in refs/meta/config.
--no-filters::
Don't run the submit_filter/2 from the parent projects of the specified change.
--format::
What output format to display the results in.
+
--
`text`:: Simple text based format.
`json`:: A JSON object described in link:json.html#submitRecord[submit record].
`json_compact`:: Minimized JSON output.
--
ACCESS
------
Can be used by anyone that has permission to read the specified changeset.
EXAMPLES
--------
Test submit_rule from stdin.
====
$ cat non-author-codereview.pl | ssh -p 29418 review.example.com gerrit test-submit-rule -s I78f2c6673db24e4e92ed32f604c960dc952437d9
Non-Author-Code-Review: NOT_READY
Verified: NOT_READY
Code-Review: NOT_READY by Anonymous Coward <test@email.com>
NOT_READY
====
Test submit_rule from stdin and return the results as JSON.
====
cat non-author-codereview.pl | ssh -p 29418 review.example.com gerrit test-submit-rule --format=JSON -s I78f2c6673db24e4e92ed32f604c960dc952437d9
{
"approvals": [
{
"type": "Verified",
"value": "NEED"
},
{
"type": "Code-Review",
"value": "OK",
"by": {
"email": "test@email.com",
"username": "test"
}
}
],
"value": "NOT_READY"
}
====
Test the active submit_rule from the refs/meta/config branch, ignoring filters in the project parents.
====
$ ssh -p 29418 review.example.com gerrit test-submit-rule I78f2c6673db24e4e92ed32f604c960dc952437d9 --no-filters
Verified: NOT_READY
Code-Review: NOT_READY by Anonymous Coward <test@email.com>
NOT_READY
====
SCRIPTING
---------
Can be used either interactively for testing new prolog submit rules, or from a script to check the submit status of a change.
GERRIT
------
Part of link:index.html[Gerrit Code Review]