Class ProjectWatches
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.
-
Nested Class Summary
Nested Classes -
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptioncom.google.common.collect.ImmutableMap
<ProjectWatchKey, com.google.common.collect.ImmutableSet<NotifyConfig.NotifyType>> void
parse()
static com.google.common.collect.ImmutableMap
<ProjectWatchKey, com.google.common.collect.ImmutableSet<NotifyConfig.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
(Map<ProjectWatchKey, Set<NotifyConfig.NotifyType>> projectWatches)
-
Field Details
-
FILTER_ALL
- See Also:
-
WATCH_CONFIG
- See Also:
-
PROJECT
- See Also:
-
KEY_NOTIFY
- See Also:
-
-
Method Details
-
getProjectWatches
public com.google.common.collect.ImmutableMap<ProjectWatchKey,com.google.common.collect.ImmutableSet<NotifyConfig.NotifyType>> getProjectWatches() -
parse
public void parse() -
parse
public static com.google.common.collect.ImmutableMap<ProjectWatchKey,com.google.common.collect.ImmutableSet<NotifyConfig.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.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.- Parameters:
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 sink- Returns:
- the parsed project watches
-
save
public org.eclipse.jgit.lib.Config save(Map<ProjectWatchKey, Set<NotifyConfig.NotifyType>> projectWatches)
-