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.NotifyType |
static class |
WatchConfig.NotifyValue |
static class |
WatchConfig.ProjectWatchKey |
VersionedMetaData.BatchMetaDataUpdate, VersionedMetaData.PathInfo
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
FILTER_ALL |
static java.lang.String |
KEY_NOTIFY |
static java.lang.String |
PROJECT |
static java.lang.String |
WATCH_CONFIG |
inserter, newTree, reader, revision
Constructor and Description |
---|
WatchConfig(Account.Id accountId) |
Modifier and Type | Method and Description |
---|---|
void |
error(ValidationError error) |
protected java.lang.String |
getRefName() |
java.util.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 java.util.Map<WatchConfig.ProjectWatchKey,java.util.Set<WatchConfig.NotifyType>> |
parse(Account.Id accountId,
org.eclipse.jgit.lib.Config cfg,
ValidationError.Sink validationErrorSink) |
void |
setProjectWatches(java.util.Map<WatchConfig.ProjectWatchKey,java.util.Set<WatchConfig.NotifyType>> projectWatches) |
commit, commitToNewRef, getObjectId, getPathInfos, getRevision, load, load, load, load, load, openUpdate, readConfig, readFile, readTree, readUTF8, saveConfig, saveFile, saveUTF8, set, set, set
public static final java.lang.String FILTER_ALL
public static final java.lang.String WATCH_CONFIG
public static final java.lang.String PROJECT
public static final java.lang.String KEY_NOTIFY
public WatchConfig(Account.Id accountId)
protected java.lang.String getRefName()
getRefName
in class VersionedMetaData
protected void onLoad() throws java.io.IOException, org.eclipse.jgit.errors.ConfigInvalidException
VersionedMetaData
onLoad
in class VersionedMetaData
java.io.IOException
org.eclipse.jgit.errors.ConfigInvalidException
public static java.util.Map<WatchConfig.ProjectWatchKey,java.util.Set<WatchConfig.NotifyType>> parse(Account.Id accountId, org.eclipse.jgit.lib.Config cfg, ValidationError.Sink validationErrorSink)
public void setProjectWatches(java.util.Map<WatchConfig.ProjectWatchKey,java.util.Set<WatchConfig.NotifyType>> projectWatches)
protected boolean onSave(org.eclipse.jgit.lib.CommitBuilder commit) throws java.io.IOException, org.eclipse.jgit.errors.ConfigInvalidException
VersionedMetaData
onSave
in class VersionedMetaData
java.io.IOException
org.eclipse.jgit.errors.ConfigInvalidException
public void error(ValidationError error)
error
in interface ValidationError.Sink
public java.util.List<ValidationError> getValidationErrors()