* stable-2.12:
Update cookbook submodule
MergeValidationListener: Expose the caller in onPreMerge() method
Correctly detect symlinked log directory on startup
RebaseIfNecessary: Use submitter identity as the committer
Fix schema migration (115) when updating from Gerrit < 2.11
Hide avatar image when there are no avatars available
Add back ListChangesOption.DRAFT_COMMENTS
Change-Id: Ibaf1264332fdc30db0f0f548121db728f78927ae
Instead of calling the Supplier<ChangeAttribute>.get for retrieving
the change key and its project and ref, we can store the attributes
when the event is created and avoid a lot of DB calls afterwards.
Change-Id: I901fc67eef51967722e18443b72a88b475c112d5
- FS is no longer required for LockFile constructor.
- TestRepository#getClock was renamed getDate.
- Replace usages of RefDatabase#getRef with either exactRef, when we
know we can bypass the full lookup path, or findRef, where the
input is user-provided and we might need to add an implicit prefix.
Change-Id: I6309b91ccf99ffaa724be273ddae0d9857b825f9
The purpose of these exceptions is to be thrown by merge validation
listeners, which may come from plugins. It doesn't make sense to force
plugins to choose a status message from a list of messages in
CommitMergeStatus that is a hard-coded enum in core.
This restriction on MergeValidationException is how we ended up with a
bunch of very specific error messages tightly coupled to the
ProjectConfigValidator.
Instead, allow arbitrary string messages, which we are now able to
effectively report from MergeOp. We don't even need to set the status
on the CodeReviewCommit when handling this exception from within
MergeOp, since failFast causes the process to abort before we ever
inspect the CodeReviewCommits.
Change-Id: Iaef3e0a5080522b9812e4709217955c877809567
* stable-2.12:
Fix sending of inline comments on commit message for initial change
AbstractQueryChangesTest: Add test for query by draft status
Fix schema 115: Create a new MetaDataUpdate instance for each update
Add the --strict-labels option to SSH review command
Allow to add custom core plugins in release build
Maven: Split Maven repository settings out to a separate def file
Change-Id: I6025858f08214056c288823fe1ce79685800182a
Add a new CUSTOM list in the plugins BUCK config, which is by
default empty. This allows a cleaner patch when adding custom
plugins to be included as 'core' in the release build of a
forked Gerrit.
Change-Id: I12783a8222550983e65bf3bbcd8aef08cdcc9bed
* Add revision http(d) test to CookbookIT for further example purposes
* Buck: Don't depend transitively on dropwizard library
* Add dropwizard lib to fix buck standalone mode
* Fix indentation
Change-Id: I810f058adc8e89254278cc60fb6bd226000e5d89
TimerContext wraps the context used in Timer{0|1|2|3} and allows to
get the start time and elapsed time.
Update the replication plugin to use it.
Change-Id: I194b9a7bd6a00bc2841ac37ca8654f0b4a2dda00
The last two changes merged on the cookbook plugin resulted in
merge commits, so the revisions specified on core were not the
latest on the head.
Set it to the correct revision of the latest commit on the head.
Change-Id: I0c1bd42bd94bedfdcc8b24319af7745b352f0859
Create a DynamicBuilder interface in the QueryBuilder class along with
supporting methods and enhancements to support defining dynamic search
operators that can be altered for each query build. Despite allowing
for dynamic modifications, the QueryBuilder class was kept generic. No
imports or dependencies on other Gerrit frameworks such as plugin logic
were added to the QueryBuilder.
Enhance the ChangeQueryBuilder to use a DynamicSet to define
DynamicBuilders so that plugins can define search operators. Plugins
can define DynamicBuilders and bind them to the DynamicSet on load.
Plugin search operators are defined similarly to the way
ChangeQueryBuilder operators are defined, by annotating methods in the
DynamicBuilder with @Operator. The name of the annotated method
determines the name of the search operator.
Change-Id: I11daed482562b82cb4dce1d8abd846f06784eb3a
- Introduce example of plugin specific configs
- Introduce example of how to connect to the MetricsRegistry
Change-Id: I85405b1fd431ded07f90ed846a74eba716e41ef6
* stable-2.11:
PatchListLoader: Synchronize MyersDiff and HistogramDiff invocations
Update singleusergroup to latest revision
ListTags: Fix ref in TagInfo for signed/annotated tags
Fix review labels with AnyWithBlock function
Fix NullPointerException in ls-project command with --has-acl-for option
Change-Id: Id758eada94c051b4137e6ffaefba1ef9093d30cc
The only remaining constructor always sets the repository, so we no
longer need to initialize it in init(). As a result, the repo field
and related fields can be made final as well.
Even better, we no longer need to distinguish between the
execute/don't execute cases in insert().
Change-Id: I39af53f954e746eee6b0e8034ccf9f68bb5549ff
The name isChangeRef is clearer.
Update the replication plugin to use the new method name.
For backwards compatibility for other plugins, keep the isRef method
and mark it as deprecated.
Change-Id: I99c6b2daeaf6c3a5e5d948ae32e0751f3ffedf31
Split the current gerrit-acceptance-tests in two parts:
* framework + some needed deps, that is exposed as additional plugin
artifact
* rest of the gerrit-acceptance-test project
To implement the split and not to pull in too many dependencies, some
refactoring was needed. Particularly, gerrit-server:testutil depends
on gerrit-server:server, that depends on almost everything. Similar
problem was with gerrit-pgm:pgm, that is needed for AbstractDaemonTest
to work. Split the rules in gerrit-pgm to break transitive dependency
chain. We shouldn't ship artifacts twice, in plugin-api and in
acceptance-framework.
This change also partially reverts Ie9e63de622, where
//gerrit-acceptance-tests:lib with all its transitive dependencies was
included in plugin-api artifact.
Expose gerrit-acceptance-framework as new plugin artifact. This allows
us to support unit tests in plugins in three different build modes:
* Buck in tree build mode
* Buck standalone build mode
* Maven build
To install gerrit-acceptance-framework locally, the following command
is used:
buck build api_install
To deploy gerrit-acceptance-framework to Maven Central, the following
command is used:
buck build api_deploy
To support unit tests in tree build mode, the following Buck variable
is exposed: GERRIT_TESTS and can be used, e.g.:
java_test(
name = 'cookbook_tests',
srcs = glob(['src/test/java/**/*IT.java']),
labels = ['cookbook-plugin'],
source_under_test = [':cookbook-plugin__plugin'],
deps = GERRIT_PLUGIN_API + GERRIT_TESTS + [
':cookbook-plugin__plugin',
],
)
To support unit tests in standalone build mode, acceptance-framework
maven jar is defined in lib/gerrit/BUCK file:
maven_jar(
name = 'acceptance-framework',
id = 'com.google.gerrit:gerrit-acceptance-framework:' + VER,
license = 'Apache2.0',
attach_source = False,
repository = REPO,
)
bucklets/gerrit_plugin.bucklet is extended with the same variable
that points to the new maven_jar artifact, so that the same Buck
java_test() rule can be used in both modes.
Test plan:
1. run tests in gerrit tree
2. apply corresponding change to cookbook-plugin and run tests in
gerrit tree mode
3. apply corresponding change to bucklets, and run tests for
cookbook-plugin in standalone build mode
Change-Id: I4cadf6616de36ca24712f8b07d282b7a50911105
Plugins having their own log file is a common case but the code for
creating it was duplicated. See, e.g. replication, delete-project and
importer plugins.
Move duplicated code into a class named PluginLogFile that plugins can
extend to have their own log file.
Change-Id: I7d7fc137e9dced27338c3bc4e19ab9d61a7b6ba6
* changes:
Sort download schemes and command names
SetPreferences: Enforce download scheme is registered
Describe allowed values for download_scheme field
DownloadUrlLink: Kill KnownScheme enum
Store preferred download scheme as arbitrary strings
DownloadConfig: Make set methods return ImmutableSet
Remove DEFAULT_SCHEMES and DEFAULT_COMMANDS
Although plugins can register download schemes with arbitrary names,
the getter/setter in AccountGeneralPreferences were allowing only a
specific enum type corresponding to the core download schemes. Get rid
of that enum type, and store arbitrary strings in the database. To
avoid a schema upgrade (which would be an annoying multi-step process
for a zero-downtime upgrade), convert to/from the old enum-string
values in AccountGeneralPreferences. Everywhere else, use the key from
the scheme map, e.g. "anonymous http" instead of "ANON_HTTP". This
eliminates the special-case code when sending RPCs from the client,
and avoids weird undocumented behavior in the set preferences REST API
call.
Change-Id: I3e2397d8dfa15d20329cc83e1e3fe069c8e021c4
Using these sentinels complicated the implementation of the core
download-commands plugin, and inadvertently allowed for undocumented
enum values when reading from the config. Simplify callers by
prepopulating the sets with the proper default values when nothing is
specified in the config.
Change-Id: Ib1cb8a255110adec241608bf62d5331fd706794e
Try with resource can't be used for instances that are got
through a provider. Suppress the warning in those cases.
Change-Id: I7670151d8f179238bd3e887cc1597902b6f28a91
The plugin revisions were updated in [1] to the sha1s in changes [2]
and [3].
However [2] and [3] were not based on the latest head of the branch,
so when they were submitted merges commit was made by Gerrit and thus
the revisions set in [1] are not the actual latest revisions on the
head of the branch.
Update them to the correct revisions.
[1] I814628e73c862d2b85b9278836a59166f5be587a
[2] Ifa47174d7c11ef5d86b2e1be2536b330b9725948
[3] I7e3f1c39076826cc515bcb7256d26937f05fea6d
Change-Id: I3dfb73598ec9045d1657649c524a817946c3b13d
User-specific URL aliases overwrite global URL aliases.
Plugins may use user-specific URL aliases to replace certain screens
for certain users. The cookbook plugin was adapted to demonstrate
this.
Change-Id: I9b4d89e9b0fcedbeceb7298b91506167d464a070
Signed-off-by: Edwin Kempin <edwin.kempin@sap.com>