295 Commits

Author SHA1 Message Date
David Pursehouse
1111684821 Squash redundant string concatenations introduced by google-java-format
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
2017-02-17 08:57:46 +09:00
Dave Borowitz
292fa154c1 Format all Java files with google-java-format
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>
2017-02-07 10:04:39 +09:00
Edwin Kempin
97f74f081d Add support for performing checks on Gerrit start up
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>
2017-01-31 16:47:14 +01:00
David Ostrovsky
fdbfcad77d Remove Buck based build
Bug: Issue 5302
Change-Id: I6e860446ef30ff0ad1c7c49fc0e39d39d921820b
2017-01-23 12:44:58 +00:00
David Pursehouse
eaee6f44bb Merge branch 'stable-2.13'
* stable-2.13:
  Fix gitweb review link
  Install "git-lfs-authenticate" SSH command when lfs.plugin is configured
  Introduce "git-lfs-authenticate" SSH Command for LFS plugins

Change-Id: I368009619cb8550e059a60e9de9e7ac83e173090
2017-01-20 10:46:43 +09:00
Jacek Centkowski
31235233d0 Install "git-lfs-authenticate" SSH command when lfs.plugin is configured
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>
2017-01-16 14:11:53 +00:00
David Pursehouse
481ba357bd Set version to 2.13.5
Change-Id: I120f598962d507db0a15121cad262f27475a71d9
2017-01-06 09:47:10 +09:00
David Pursehouse
af1d5a530d Set version to 2.13.4
Change-Id: Id5f193630beba6f77a51945e93e9ccc6cac7312c
2016-12-12 13:46:41 +09:00
David Ostrovsky
fa18907d7f Bazel: Reformat build files
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
2016-12-07 11:33:07 +00:00
Luca Milanesio
62cc3503b9 Support for loading Guice modules from /lib
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
2016-11-18 14:26:47 -08:00
David Pursehouse
1dc6bfd3b9 Set version to 2.13.3
Change-Id: Ief9003913f7af82a849dab81fdd0b19c7b13c0e7
2016-11-15 18:34:46 -08:00
Patrick Hiesel
328b761528 Implement receiver class structure and bindings
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
2016-11-07 11:18:45 +01:00
Han-Wen Nienhuys
29cced5e29 bazel: remove 'out' attribute from genrule2, and use throughout.
This centralizes the OSX mktemp solution.

Change-Id: Iaab18450146b649245b36865bedc5d7b50d1aa07
2016-11-02 13:54:10 +01:00
Han-Wen Nienhuys
dc255120cf Reinstate 214171ddda6c173e528affee625aa65db8dcc360
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
2016-10-24 14:47:44 +02:00
ekempin
11c7ef4802 Merge "Move code to send emails into 'mail.send' package" 2016-10-24 06:57:09 +00:00
David Ostrovsky
47deed6a86 Revert "bazel: generate the workspace version from the volatile status."
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
2016-10-24 11:39:36 +09:00
Patrick Hiesel
dc8478137a Move code to send emails into 'mail.send' package
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
2016-10-23 23:44:31 +00:00
David Pursehouse
7e2d2f2707 Set version to 2.13.2
Change-Id: I37839ff47ac133de689a7a4ecc06bb1dd2c17fba
2016-10-19 17:42:55 +09:00
Han-Wen Nienhuys
5e4491886b bazel: update for elasticsearch and lucene.
Change-Id: Icb9f9f0344b10a008d5b353362933890446eb544
2016-09-28 21:17:08 +02:00
David Pursehouse
5ad256eecb Organize imports
Change-Id: If192d666a70a787b65b9a2da644af8233cae92fd
2016-09-28 17:51:30 +09:00
Dave Borowitz
d08edf6a71 Merge changes from topic 'elasticsearch'
* changes:
  Introduce gerrit-index module
  Add support for secondary index with Elasticsearch
2016-09-28 08:38:54 +00:00
David Pursehouse
8e72f5301b Add support for secondary index with Elasticsearch
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
2016-09-27 23:27:37 +09:00
Han-Wen Nienhuys
214171ddda bazel: generate the workspace version from the volatile status.
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
2016-09-27 15:01:24 +02:00
Hugo Arès
52653bf971 Set version to 2.13.1
Change-Id: Ib4d8086f25867f6a440d02816778108d2ad4470b
2016-09-23 14:28:31 +02:00
Hugo Arès
6c3dc1b733 Set version to 2.13.1-SNAPSHOT
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
2016-09-22 09:22:59 +02:00
David Pursehouse
c36d5aabe2 Set version to 2.13
Change-Id: I3acf8ce118acf7fee4f94cd4059bdd4b1d2da9b5
2016-09-21 16:26:03 +02:00
Dave Borowitz
f4599a001d Expose supported UIs in GetServerInfo
Requires moving GerritInfo into gerrit-server.

Change-Id: I447c29c553e693c4aa02665610101588bdde38c6
2016-09-20 16:09:54 -04:00
David Ostrovsky
e0f23b9f0d Implement Bazel build for gerrit-war project
Change-Id: I962fccfea823f42be186d518591145c6278021ba
2016-09-19 16:57:32 +02:00
David Pursehouse
53c29d1643 Set version to 2.13-rc1
Change-Id: I7cfc123378a4ff9169c60f9766809da6e56d62b1
2016-09-15 09:00:06 +02:00
David Pursehouse
49d9a46904 Move AuthType from gerrit-reviewdb to extension API
Change-Id: I94d93e7776accd08d9d307781952b899ba13cbad
2016-08-23 17:27:50 +09:00
Hugo Arès
02d2ed1d6b Set version to 2.14-SNAPSHOT
Change-Id: Id149cf6f80e2f18af2b8b9f00c05afbbc78d687e
2016-08-19 08:51:10 -04:00
David Pursehouse
5f8dd4f43e Merge branch 'stable-2.12'
* 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
2016-08-18 09:09:43 -04:00
Hugo Arès
1b5c946d7e Fix log files not being compressed when running in a web container
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
2016-08-17 13:29:15 -04:00
David Pursehouse
44d51bfed0 StreamEventsApiListener: Move to com.google.gerrit.server.events
Change-Id: Iabc8df364c7be12a533692e363bb6a0191dc056d
2016-07-08 06:26:25 +00:00
David Pursehouse
05541e11bb Set version to 2.12.3
Change-Id: Ic06757273bb29277ef8384c48cbcfa2165809ea2
2016-07-07 13:15:21 +09:00
David Pursehouse
cad96d6462 Move hooks from core Gerrit to 'hooks' plugin
Change-Id: If45b32ffb0e9f52677886103212563d8af6c6099
2016-07-04 11:06:18 +09:00
Edwin Kempin
ea65e9bff1 Merge "Migrate reviewed flags to local H2 database" 2016-06-27 14:27:11 +00:00
David Pursehouse
d633834772 Merge branch 'stable-2.12'
* 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
2016-06-27 11:08:44 +09:00
Edwin Kempin
15ca7b0bcb Migrate reviewed flags to local H2 database
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>
2016-06-23 09:52:36 +02:00
David Pursehouse
ff0569a68a Update issue tracker URL in POM files
Change-Id: Ib2130947709532ae3ded532e35f61d8a16c4e332
2016-06-23 06:47:46 +00:00
David Pursehouse
1265695878 Decouple stream events from change hooks
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
2016-06-23 08:13:26 +09:00
Martin Fick
d432c83a72 Make hooks/events listen to the new API Events.
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
2016-06-23 08:13:26 +09:00
Shawn Pearce
0638cc98e0 Remove dead ScanningChangeCacheImpl
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
2016-06-19 14:00:08 -04:00
Edwin Kempin
da17bc33c2 Add extension point for storing reviewed flags
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>
2016-06-14 13:26:29 +02:00
David Pursehouse
ccdeae8e64 Use native constructors instead of Guava to instantiate empty collections
It's not necessary to use Guava's helper methods when instantiating
empty collections. Just use the native constructors.

Change-Id: I7f454909b15924ee49e149edf9f053da9f718502
2016-05-04 22:41:39 +09:00
Dave Borowitz
65e550a18c Merge "Buck: Remove jgit cell" 2016-04-20 20:29:47 +00:00
David Ostrovsky
08ea694499 Buck: Remove jgit cell
Cross cell support in Buck is considered as experimental feature, with
number of open issues: [1], [2], [3].  Moreover, to make Maven Central
machinery work, it was needed to create symbolic links in source tree.
That broke `buck targets` feature.

Remove it for now, and re-consider to add it later.

[1] https://github.com/facebook/buck/issues/656
[2] https://github.com/facebook/buck/issues/658
[3] https://github.com/facebook/buck/issues/717

Bug: Issue 3954
Change-Id: Ic621a07771f926001df181b46b2169e214ce208a
2016-04-20 22:02:49 +02:00
Andrew Bonventre
4adac426a1 Load plugins JS resources upon initial page rendering
Bug: Issue 3915
Change-Id: Ic2d1d96458ecb2cd09dcd1cd204f8a06f234dbb7
2016-04-20 10:51:05 -04:00
David Pursehouse
d79c03a7f6 Remove redundant 'public' modifiers
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
2016-04-12 21:46:12 +09:00
Dave Borowitz
d751ec1c6c Merge changes from topic 'repo-manager-gh16'
* changes:
  Support multiple git repositories locations
  Rework LocalDiskRepositoryManager to be extendable
2016-03-18 12:58:07 +00:00