Add event hook support
The following hooks are defined and implemented: * patchset-created --change <change id> --project <project name> --branch <branch> --commit <sha1> --patchset <patchset id> * comment-added --change <change id> --project <project name> --branch <branch> --author <comment author> --comment <comment> [--<approval category id> <score> --<approval category id> <score> ...] * change-merged --change <change id> --project <project name> --branch <branch> --submitter <submitter> --commit <sha1> * change-abandoned --change <change id> --project <project name> --branch <branch> --abandoner <abandoner> --reason <reason> Bug: issue 368 Bug: issue 383 Change-Id: Ic2f041a71c744d0938d79b1106c9119d6318731a Signed-off-by: Shawn O. Pearce <sop@google.com>
This commit is contained in:
committed by
Shawn O. Pearce
parent
48bc519a98
commit
6c2b677980
79
Documentation/config-hooks.txt
Normal file
79
Documentation/config-hooks.txt
Normal file
@@ -0,0 +1,79 @@
|
||||
Gerrit Code Review - Hooks
|
||||
==========================
|
||||
|
||||
Gerrit does not run any of the standard git hooks in the
|
||||
repositories it works with, but it does have its own hook mechanism
|
||||
included. Gerrit looks in `'$site_path'/hooks` for executables with
|
||||
names listed below.
|
||||
|
||||
The environment will have GIT_DIR set to the full path of the
|
||||
affected git repository so that git commands can be easily run.
|
||||
|
||||
Make sure your hook scripts are executable if running on *nix.
|
||||
|
||||
Hooks are run in the background after the relevent change has
|
||||
taken place so are unable to affect the outcome of any given
|
||||
change. Because of the fact the hooks are run in the background
|
||||
after the activity, a hook might not be notified about an event if
|
||||
the server is shutdown before the hook can be invoked.
|
||||
|
||||
Supported Hooks
|
||||
---------------
|
||||
|
||||
patchset-created
|
||||
~~~~~~~~~~~~~~~~
|
||||
|
||||
This is called whenever a patchset is created (this includes new
|
||||
changes)
|
||||
|
||||
====
|
||||
patchset-created --change <change id> --project <project name> --branch <branch> --commit <sha1> --patchset <patchset id>
|
||||
====
|
||||
|
||||
comment-added
|
||||
~~~~~~~~~~~~~
|
||||
|
||||
This is called whenever a comment is added to a change.
|
||||
|
||||
====
|
||||
comment-added --change <change id> --project <project name> --branch <branch> --author <comment author> --comment <comment> [--<approval category id> <score> --<approval category id> <score> ...]
|
||||
====
|
||||
|
||||
change-merged
|
||||
~~~~~~~~~~~~~
|
||||
|
||||
Called whenever a change has been merged.
|
||||
|
||||
====
|
||||
change-merged --change <change id> --project <project name> --branch <branch> --submitter <submitter> --commit <sha1>
|
||||
====
|
||||
|
||||
change-abandoned
|
||||
~~~~~~~~~~~~~~~~
|
||||
|
||||
Called whenever a change has been abandoned.
|
||||
|
||||
====
|
||||
change-abandoned --change <change id> --project <project name> --branch <branch> --abandoner <abandoner> --reason <reason>
|
||||
====
|
||||
|
||||
|
||||
Configuration Settings
|
||||
----------------------
|
||||
|
||||
It is possible to change where gerrit looks for hooks, and what
|
||||
filenames it looks for by adding a [hooks] section to gerrit.config.
|
||||
|
||||
Gerrit will use the value of hooks.path for the hooks directory, and
|
||||
the values of hooks.patchsetCreatedHook, hooks.commentAddedHook,
|
||||
hooks.changeMergedHook and hooks.changeAbandonedHook for the
|
||||
filenames for the hooks.
|
||||
|
||||
See Also
|
||||
--------
|
||||
|
||||
* link:config-gerrit.html#hooks[Section hooks]
|
||||
|
||||
GERRIT
|
||||
------
|
||||
Part of link:index.html[Gerrit Code Review]
|
||||
Reference in New Issue
Block a user