Reformatting the code with google-java-format tool in change Id5f3c6de9
resulted in wrapped lines being unwrapped to the new 100 columns limit.
In cases where the wrapped line was wrapped on a string concatenation,
the resulting long line now includes redundant concatenations. See the
upstream issue [1] for an example of this.
Squash the redundant concatenations with:
git ls-files | grep java$ | xargs sed -i '' 's/" + "//g'
(note: this also resulted in a couple of unwanted changes; those are
manually undone.)
[1] https://github.com/google/google-java-format/issues/122
Change-Id: I7348413ae460c8c7a0b0c72dab0a1ae7275a2ec3
Having a standard tool for formatting saves reviewers' valuable time.
google-java-format is Google's standard formatter and is somewhat
inspired by gofmt[1]. This commit formats everything using
google-java-format version 1.2.
The downside of this one-off formatting is breaking blame. This can be
somewhat hacked around with a tool like git-hyper-blame[2], but it's
definitely not optimal until/unless this kind of feature makes its way
to git core.
Not in this change:
* Tool support, e.g. Eclipse. The command must be run manually [3].
* Documentation of best practice, e.g. new 100-column default.
[1] https://talks.golang.org/2015/gofmt-en.slide#3
[2] https://commondatastorage.googleapis.com/chrome-infra-docs/flat/depot_tools/docs/html/git-hyper-blame.html
[3] git ls-files | grep java$ | xargs google-java-format -i
Change-Id: Id5f3c6de95ce0b68b41f0a478b5c99a93675aaa3
Signed-off-by: David Pursehouse <dpursehouse@collab.net>
This allows to do checks on Gerrit startup and abort the Gerrit startup
if issues are found. E.g. this allows us to do validation on the Gerrit
config, which is needed by a follow-up change.
The startup checks are done after all lifecycle listeners have been
invoked so that logging is already available and the reason for a
failing startup can be written to the error log.
All implementations of StartupCheck should be bound in
StartupChecks.Module.
Change-Id: I941dad2c926130a1f9c5a1a363f7e1eff0dab304
Signed-off-by: Edwin Kempin <ekempin@google.com>
SSH command registration was extended so that command gets registered
only in case when plugin is configured in gerrit.config.
Change-Id: Iffaf00775bdf1242e1fbe1dea15e5ce0bf912079
Signed-off-by: Jacek Centkowski <geminica.programs@gmail.com>
Reformat the Bazel build files with the buildifier tool [1].
The style is different for Bazel files. Most notably, indentation level
is 4 spaces instead of 2, and " is used instead of '.
[1] https://github.com/bazelbuild/buildifier
Change-Id: I95c0c6f11b6d76572797853b4ebb5cee5ebd3c98
Gerrit already has "pluggable" features that need to be installed
at the early stages of the bootstrap phase and cannot be "unplugged"
as plugins do.
Attendees at the recent hackathon in Mountain View decided to
call this new entities "LibModules", and configure them in the
gerrit.config as follows:
[gerrit]
installModule = com.googlesource.gerrit.libmodule.MyModule
installModule = com.example.abc.OurSpecialSauceModule
Change-Id: Id8bf1a2e88b14c8e9125f20cb10a041d47799100
This commit implements the basic class structure for receiving emails,
all required config parameters, all necessary bindings depending on
which protocol the administrator has configured and updates the
documentation accordingly.
It also adds test-only dependencies to Greenmail and javax.mail. These
will be used to create integration tests.
It's the first change in a topic of changes to implement email ingestion
for Gerrit.
Change-Id: I0edec7ca2655fcd70284bb75ca8eb94ce2491d7a
bazel: generate the workspace version from the volatile status.
To work across bazel 0.3.1 and 0.3.2, we should grep both volatile and
stable status files for the magic version string.
Change-Id: I48361374a8d9cda1e7a5b5db4e147bc49b4452a3
Bazel 0.3.2 introduced regression: [1] workspace_status_command seems to
be ignored. That broke Bazel build. Revert this change and re-consider to
re-apply it, when the problem is fixed upstream.
* [1] https://github.com/bazelbuild/bazel/issues/1976
This reverts commit 214171ddda6c173e528affee625aa65db8dcc360.
Change-Id: I729ffaf6ae1bff5fb858d78de2a6915058c9e651
We will implement code to receive emails soon and having that code
side-by-side with the code to send email makes the whole package seem
overloaded.
Change-Id: I88dd9d5f537c4ed8f6608ee62d08f7dbd75d21a4
Add support for secondary index on Elasticsearch via the REST API
using the Jest client [1].
Because Elasticsearch uses different version of Lucene we add another
maven_jar's in gerrit-elasticsearch BUCK. Fortunately both versions have
compatible API, this way we are able to compile and run Gerrit.
All tests for changes index passes, but they need to use Lucene's based
account index.
[1] http://www.searchly.com/documentation/developer-api-guide/java-jest/
TODO: Add support for online reindex
TODO: Add support for schema upgrades
Also-By: Janice Agustin <janice.agustin@ericsson.com>
Also-By: Olga Grinberg <olga.grinberg@ericsson.com>
Also-By: Dariusz Luksza <dluksza@collab.net>
Change-Id: I5e4fc08ce34d33c090c9e0bf320de1b17309f774
This generates a version file that looks correct, but doesn't rebuild
correctly. Correct rebuilds will be provided by a version of
bazel containing
a2897bff4c
Change-Id: I5101d7f2643d464cf32c8281a28ec6c3fc4fa2cf
I did not change the archetype version referred in the dev documentation
in case documentation need to be updated before 2.13.1 is released.
Change-Id: I5bef5050da4e5f1cbe46041a2ba605e8b192aa6e
* stable-2.12:
Fix log files not being compressed when running in a web container
Update replication plugin
Fix 'is:watched' query hanging issue due to no authenticated user
Bypass hostname verification with sendemail.sslVerify
Clarify in documentation that username cannot be changed
Update 2.12.4 release notes with info about known issue 4323
Update 2.12.4 release notes
Change-Id: I971d2ac9dc145494581e7cc61c13551d5223f178
When the log file compressor task was introduced, the only log file in
the review_site/logs folder at that time was error_log. It made sense to
not schedule that task when running in a web container because error_log
doesn't exist in that case.
Since then, many other logs were added and they end up in
review_site/logs folder even if you run in a web container (sshd_log,
replication_log, gc_log,...).
Change-Id: Ic2ac866660798b56e481c4d169233ca393d74810
* stable-2.12:
ChangeIT: Assert that submitting a change doesn't remove non-voting reviewers
Instead of deleting patch-set-approval set vote to zero
ChangeIT#commitFooters: Fix setup of test labels
CreateChangeIT: Fix flaky test
Add a testing method to set the clock step used by TimeUtil
Update issue tracker URL in documentation
Update issue tracker URL in POM files
Change-Id: I991be7faf90cd37a8d664a0c951fea4c14f94492
With NoteDb Gerrit will no longer have a database. Hence all data from
ReviewDb must be migrated away from it. This change migrates the
reviewed flags from ReviewDb to a local H2 database.
Reviewed flags are tuples of (patch set ID, file, account ID) and
record whether a user has reviewed a file in a patch set. Each user
can easily have thousands of reviewed flags and the number of reviewed
flags is growing without bound.
Most data from ReviewDb is migrated to be stored in git, but for
reviewed flags a git-based storage is not very well suitable because
there is a relatively high write latency [1]. Also depending on the
exact storage format updating reviewed flags may create a huge git
history which is not good for anything since an audit log for reviewed
flags is not needed [1].
Since reviewed flags are small per-user bits that are quickly read and
updated a database seems to be the best storage [2]. This is why with
this change the reviewed flags will be stored in a local H2 database.
This store implements the AccountPatchReviewStore extension point that
was added by change Iaaacd9f0a. Plugins can implement this extension
point and replace the local H2 database with another storage.
To support multi-master the local H2 database must be replaced by a
storage that supports replication, e.g. a MySQL replication system
[2]. This can be done by implementing the AccountPatchReviewStore
extension point.
A schema migration copies all reviewed flags from ReviewDb to the
local H2 database and the old ACCOUNT_PATCH_REVIEWS table in ReviewDb
is dropped.
Not using gwtorm to access the local H2 database is intentional. When
ReviewDb is gone, we want to drop the dependency to gwtorm, and hence
we don't want to introduce any new dependencies to it. Instead the
implementation is using raw SQL.
The local H2 database is stored in the review site in:
$site_path/db/account_patch_reviews.h2.db
For the acceptence tests an in memory H2 database is used.
[1] https://groups.google.com/d/msg/repo-discuss/KhXKMKTJNMs/Tq3XaB8wCgAJ
[2] https://groups.google.com/d/msg/repo-discuss/KhXKMKTJNMs/hHoCa1_5CwAJ
Change-Id: I7cb77ff124e36709cc69ef547f2b4e5e1a1d7f62
Signed-off-by: Edwin Kempin <ekempin@google.com>
Stream events are currently being dispatched from the change hooks
runner.
Both stream events and change hooks will eventually be evicted from
core Gerrit to plugins. Separating the stream events from hooks will
make it easier to move them to plugins separately.
Change-Id: I00c6728fbc52557a3360408272dc84c205c53b2f
Create a ChangeHookApiListener to listen to the new API Events and
forward these events to the old legacy ChangeHookRunner. This decouples
the hooks and stream events from the internal events. This also
decouples the ChangeHooks interface (and implementations) from all
internal classes except for the new ChangeHookApiListener. This
decoupling should now make it very easy to move all of these classes to
plugins.
Change-Id: I9153dca45727f1c7ea10a8d003e1acf2171b39ac
The ScanningChangeCacheImpl is now dead code. With VisibleRefFilter
using SearchingChangeCacheImpl directly the ScanningChangeCacheImpl
is no longer referenced by the server. This also lets us get rid of
the ChangeCache interface.
This cleanup of dead code enables further optimization of the
VisibleRefFilter -> SearchingChangeCacheImpl path.
Change-Id: I07144006358a70915ea0bf10ce04a8b826f22095
At the moment the reviewed flags are stored in ReviewDb, but to fully
migrate to NoteDb they must be moved to a different storage. Different
options how to implement this storage were discussed on the Gerrit
mailing list [1,2]. Standalone Gerrit servers can benefit from a
simple storage in a local H2 database, while multi-master
installations must care to replicate this data between the master
nodes. To support both cases well this extension point makes the store
implementation pluggable. Gerrit itself implements the extension
point, but plugins can replace this implementation. For now the
implementation of this extension point in Gerrit just wraps the access
to the ReviewDb, but in a follow-up change another storage and a data
migration will be implemented.
[1] https://groups.google.com/forum/#!msg/repo-discuss/KhXKMKTJNMs/Tq3XaB8wCgAJ
[2] https://groups.google.com/d/msg/repo-discuss/KhXKMKTJNMs/hHoCa1_5CwAJ
Change-Id: Iaaacd9f0af977ccd505b5ad541f4a616afa214a4
Signed-off-by: Edwin Kempin <ekempin@google.com>
It's not necessary to use Guava's helper methods when instantiating
empty collections. Just use the native constructors.
Change-Id: I7f454909b15924ee49e149edf9f053da9f718502
CheckStyle reports 'public' being redundant on the constructor of
ApproveOption#Handler, but removing it causes test failures due to
org.kohsuke.args4j.Option requiring an explicitly public constructor.
Add a suppression for that one, and remove the 'public' in other
places where it's reported.
Change-Id: Ifbcf279ffa783d33b81efc1c675f468c3ea39135