public class ProjectWatches
extends java.lang.Object
Config
file.
This is a low-level API. Read/write of project watches in a user branch should be done through
AccountsUpdate
or AccountConfig
.
The config file 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.
The project watches are lazily parsed.
Modifier and Type | Class and Description |
---|---|
static class |
ProjectWatches.NotifyType |
static class |
ProjectWatches.NotifyValue |
static class |
ProjectWatches.ProjectWatchKey |
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 |
Modifier and Type | Method and Description |
---|---|
com.google.common.collect.ImmutableMap<ProjectWatches.ProjectWatchKey,com.google.common.collect.ImmutableSet<ProjectWatches.NotifyType>> |
getProjectWatches() |
void |
parse() |
static com.google.common.collect.ImmutableMap<ProjectWatches.ProjectWatchKey,com.google.common.collect.ImmutableSet<ProjectWatches.NotifyType>> |
parse(Account.Id accountId,
org.eclipse.jgit.lib.Config cfg,
ValidationError.Sink validationErrorSink)
Parses project watches from the given config file and returns them as a map.
|
org.eclipse.jgit.lib.Config |
save(java.util.Map<ProjectWatches.ProjectWatchKey,java.util.Set<ProjectWatches.NotifyType>> projectWatches) |
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 com.google.common.collect.ImmutableMap<ProjectWatches.ProjectWatchKey,com.google.common.collect.ImmutableSet<ProjectWatches.NotifyType>> getProjectWatches()
public void parse()
public static com.google.common.collect.ImmutableMap<ProjectWatches.ProjectWatchKey,com.google.common.collect.ImmutableSet<ProjectWatches.NotifyType>> parse(Account.Id accountId, org.eclipse.jgit.lib.Config cfg, ValidationError.Sink validationErrorSink)
A project watch is defined on a project and has a filter to match changes for which the project watch should be applied. The project and the filter form the map key. The map value is a set of notify types that decide for which events email notifications should be sent.
A project watch on the All-Projects
project applies for all projects unless the
project has a matching project watch.
A project watch can have an empty set of notify types. An empty set of notify types means
that no notification for matching changes should be set. This is different from no project
watch as it overwrites matching project watches from the All-Projects
project.
Since we must be able to differentiate a project watch with an empty set of notify types
from no project watch we can't use a Multimap
as return type.
accountId
- the ID of the account for which the project watches should be parsedcfg
- the config file from which the project watches should be parsedvalidationErrorSink
- validation error sinkpublic org.eclipse.jgit.lib.Config save(java.util.Map<ProjectWatches.ProjectWatchKey,java.util.Set<ProjectWatches.NotifyType>> projectWatches)