public class WatchConfig extends VersionedMetaData implements ValidationError.Sink
The 'watch.config' file is a git config file that has one 'project' section for all project watches of a project.
The project name is used as subsection name and the filters with the notify
types that decide for which events email notifications should be sent are
represented as 'notify' values in the subsection. A 'notify' value is
formatted as <filter> [<comma-separated-list-of-notify-types>]
:
[project "foo"] notify = * [ALL_COMMENTS] notify = branch:master [ALL_COMMENTS, NEW_PATCHSETS] notify = branch:master owner:self [SUBMITTED_CHANGES]
If two notify values in the same subsection have the same filter they are merged on the next save, taking the union of the notify types.
For watch configurations that notify on no event the list of notify types is empty:
[project "foo"] notify = branch:master []
Unknown notify types are ignored and removed on save.
Modifier and Type | Class and Description |
---|---|
static class |
WatchConfig.Accessor |
static class |
WatchConfig.NotifyValue |
static class |
WatchConfig.ProjectWatchKey |
VersionedMetaData.BatchMetaDataUpdate, VersionedMetaData.PathInfo
Modifier and Type | Field and Description |
---|---|
static String |
KEY_NOTIFY |
static String |
PROJECT |
static String |
WATCH_CONFIG |
inserter, newTree, reader, revision
Constructor and Description |
---|
WatchConfig(com.google.gerrit.reviewdb.client.Account.Id accountId) |
Modifier and Type | Method and Description |
---|---|
void |
error(ValidationError error) |
protected String |
getRefName() |
List<ValidationError> |
getValidationErrors()
Get the validation errors, if any were discovered during load.
|
protected void |
onLoad()
Set up the metadata, parsing any state from the loaded revision.
|
protected boolean |
onSave(org.eclipse.jgit.lib.CommitBuilder commit)
Save any changes to the metadata in a commit.
|
static Map<WatchConfig.ProjectWatchKey,Set<com.google.gerrit.reviewdb.client.AccountProjectWatch.NotifyType>> |
parse(com.google.gerrit.reviewdb.client.Account.Id accountId,
org.eclipse.jgit.lib.Config cfg,
ValidationError.Sink validationErrorSink) |
commit, commitToNewRef, getObjectId, getPathInfos, getRevision, load, load, load, load, load, openUpdate, readConfig, readFile, readTree, readUTF8, saveConfig, saveFile, saveUTF8, set, set, set
public static final String WATCH_CONFIG
public static final String PROJECT
public static final String KEY_NOTIFY
public WatchConfig(com.google.gerrit.reviewdb.client.Account.Id accountId)
protected String getRefName()
getRefName
in class VersionedMetaData
protected void onLoad() throws IOException, org.eclipse.jgit.errors.ConfigInvalidException
VersionedMetaData
onLoad
in class VersionedMetaData
IOException
org.eclipse.jgit.errors.ConfigInvalidException
public static Map<WatchConfig.ProjectWatchKey,Set<com.google.gerrit.reviewdb.client.AccountProjectWatch.NotifyType>> parse(com.google.gerrit.reviewdb.client.Account.Id accountId, org.eclipse.jgit.lib.Config cfg, ValidationError.Sink validationErrorSink)
protected boolean onSave(org.eclipse.jgit.lib.CommitBuilder commit) throws IOException, org.eclipse.jgit.errors.ConfigInvalidException
VersionedMetaData
onSave
in class VersionedMetaData
IOException
org.eclipse.jgit.errors.ConfigInvalidException
public void error(ValidationError error)
error
in interface ValidationError.Sink
public List<ValidationError> getValidationErrors()