Guava team recommends MultimapBuilder over specific Multimap
implementations, so callers don't have to know the specific key/value
behaviors of the individual implementations. The static factory
methods in the implementations will be removed in a later version.
LinkedListMultimap and LinkedHashMultimap are not affected, since
MultimapBuilder lacks support for specifying linked entries, and thus
the factory methods are not in immediate danger of deletion.
Change-Id: I7744db687da84a7beae31d1cb8953e782ed23c1d
Guava team recommends using the subinterfaces of Multimap, for the
same reasons they recommend using Set and List rather than Collection:
it documents expectations about ordering, uniqueness, and behavior of
equals. Do this across the board in Gerrit.
Mostly this is straightforward and I tried to exactly match existing
behavior where possible. However, there were a few wrinkles, where
different callers passed different subtypes to the same method.
The main one is arguments to ParameterParser#parse and
splitQueryString, where some callers used SetMultimaps (perhaps
semi-intentionally, or perhaps misunderstanding the nature of
HashMultimap). For the purposes of parameter parsing, a ListMultimap
makes more sense, because it preserves argument order and repetition.
Another instance is a couple places in ReceiveCommits and downstream
where there were SetMultimap<?, Ref>. Since Refs do not implement
equals, this is effectively the same thing as a ListMultimap, and
changing the interface no longer misleads readers into thinking there
might be some deduplication happening.
Finally, this change includes a breaking API change to the return
type of ExternalIncludedIn#getIncludedIn.
Change-Id: I5f1d15e27a32e534a6aaefe204e7a31815f4c8d7
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>
* changes:
Index groups that are created during init
Implement group index for ElasticSearch
Add REST endpoint to reindex a single group
Support default query for groups
Add query operator that matches groups that are visible to all users
Add group query operator to match groups by owner
Add group query operator to match groups by description
Support querying groups by name and name part
Set '_more_groups' on last group of query result
Add tests for group index
Groups API: Add query methods
Support arbitrary group queries via REST
Add new optional interface for REST collections to get request params
Add GroupQueryProcessor
IsVisibleToPredicate: Move describe method into base class
Index group on creation and whenever a group is evicted from cache
Initial implementation of group index in Lucene
Add initial GroupQueryBuilder and define key predicate for group index
Add schema and index definitions for groups index
* stable-2.13:
Gerrit command line utility to set/update secure.config
Fix naming and message prompt for entering passwords
Don't truncate long lines in diff screens
Change-Id: I2210d94e0bc7374eff26614145e3a76b526177f5
When using a secure store for encrypting the secure.config
values, an utility or tool is needed to edit the values
using the same encryption key used by Gerrit at runtime.
Change-Id: Iacb017b010f7efd8217255796e571c5291499c0e
Introducing a cache for external ids is a preparation step for moving
the external ids from ReviewDb into NoteDb. For NoteDb it is planned
to store the external ids in a git note branch, where the note keys
are the sha1's of the external ids and the note values contain the
external id, the account id and optionally email and password. With
this format we can easily lookup external ids by the external id, but
listing all external ids of an account requires parsing all external
ids. Looking up the external ids of an account is possible from the
account index, however for reindexing an account we would still need
to lookup all external ids of the account from git. Having a cache for
the external ids ensures that the external ids are only loaded once
from git. If there is any update to external ids, we take care to
update the cache as well. For this change it means that all code that
modifies external ids must do an extra call to update the external id
cache. This is not optimal since updating the cache can be easily
forgotten. This is why the follow-up change cleans this up by
introducing a dedicated class that handles all external id updates and
then this is the only class that must take care to update the external
id cache.
Change-Id: I9ea979c646cddb9b39e723de5c061a70a2ce6fd6
Signed-off-by: Edwin Kempin <ekempin@google.com>
During the initialization of a new site the InitAdminUser init step
may create an account for the initial admin user. This new account
must be added to the index so that it becomes queryable. For this init
must have the account index available so that it can write the new
account to it. Reading from the index during init is not needed and
not supported.
Alternatively we could require users to run the Reindex program after
the initial site initialization, but likely many people would forget
about it and then wonder why the initial admin user is not working.
Change-Id: Iebee152fa0b28df3fe59da74ad688c4373488c53
Signed-off-by: Edwin Kempin <ekempin@google.com>
During the initialization of a new site some default groups are
automatically created ('Administrators' and 'Non-Interactive Users').
These new groups must be added to the index so that they become
queryable. For this init must have the group index available so that
it can write the new groups to it. Reading from the index during init
is not needed and not supported.
Alternatively we could require users to run the Reindex program after
the initial site initialization, but likely many people would forget
about it and then wonder why the default groups are not available from
the group index.
Change-Id: I274b142a6efde224bba68f8b5c459736d7a1f985
Signed-off-by: Edwin Kempin <ekempin@google.com>
ProjectQoSFilter uses username as a part of task info. However,
AuthFilter which comes later than ProjectQoSFilter renders the
value of username. As a result, username never gets resolved when
using git with http.
The current patch set resolves the username only when it is used,
i.e., in the toString method, and saves the value for reusage.
Bug: Issue 5206
Change-Id: I280c95b242d599919eee3c7007c60a0047170166
This fixes resource leak with JarFile instance acquired by call to
ctor of JarScanner.
Bug: Issue 5198
Change-Id: I80feabcf9e0bfd683d1d8c47f3fd6c9be3ff65a6
* stable-2.13:
Change kind cache: Don't fail if prior ps has no parent, but next ps has 1 parent
Make Gerrit startup timeout configurable
Change-Id: I2e6a53eb33cbe2e3059e65bd72bf80ff65fc2f3b
Allow users to configure the maximum time to wait for the gerrit.sh
start command to run Gerrit.
Bug: Issue 5179
Change-Id: If6ad15b51081c26ff02ecb7ad513551733ce1f79
* submodules:
* Update plugins/replication from branch 'master'
- Remove test prefix from test methods in replication plugin
We previously used 'test' to prefix tests but have decided to stop this.
This change removes the prefix from all test code.
Change-Id: I42e6191ece7872f4647e425e3ca0acf8c6452412
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
Users want to get informed when they are assigned to a change. So far
there was no email notification on assigning a change to a user.
Change-Id: I7953b552f9814c283392b02520f5129e97cff9ff
Signed-off-by: Edwin Kempin <ekempin@google.com>
We previously used 'test' to prefix tests but have decided to stop this.
This change removes the prefix from all test code.
Change-Id: I229a36751adc6a87fbae8d6f373671e141529496
The error() method is added on the ConsoleUI abstract class so that it
can be used in both interactive and batch modes. This allows to output
messages that can be used to diagnose problems even when running a site
initialization in batch mode.
Change-Id: I62d6bae11b7b5f3850e3fac1e8b3da545e0a9575
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
Most of the index abstraction classes were already in gerrit-server
except 3 classes that were recently added in gerrit-index.
Change-Id: Id7360ff70bef377c27c9cad9a591a63e72728a61
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
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
Upgrade comment emails to emit HTML bodies in addition to the existing
plain-text message bodies. The format of the HTML body is remains
similar to the plain-text format, with the following small changes:
* File links are anchor tags rather than plain URLs.
* Parent comment quotations are set in BLOCKQUOTE tags rather than
prefixed by the > character.
* Code quotations are monospaced rather than set in a
proportionate-width font.
* Mult-line code quotations are set in BLOCKQUOTE tags rather than
being prefixed by spaces followed by a colon.
* File groupings are set in nested UL & and LI tags rather than
separating groups with an extra line feed.
Change-Id: I2ac21961b6d48e3fb3455ca6a3e30d86e50b567c
These shouldn't happen, but we've observed some in production
(possibly involving a custom group backend). Logging might help us
track it down.
Change-Id: Ib7a956774647d1bea4fb49ad55376de0408dcf71
The behavior and signature of this method is tied pretty closely to
how we rebuild project-by-project in RebuildNoteDb. In particular
googlesource.com's migration code never used this method.
Moving this means we do have to expose the buildUpdates method from
ChangeRebuilderImpl, but that's a much more generic signature.
Change-Id: I375a74a5e5de619995703866ffd62e941d0ab10d
The default value of plugins.allowRemoteAdmin is false, which is
a sensible default, but is annoying to have to manually enable for
every test site.
Make it less annoying by enabling it by default in developer mode.
Introduce a new init step that is run when developer mode is
enabled, i.e. when --dev is given and the site is initialized for
the first time.
It may seem like overkill to have a dedidated init step only to
set plugins.allowRemoteAdmin, but this will also allow us to set
any other developer mode specific settings in future.
Change-Id: Ia22b24570d696111d10006203c1bdacc4db31022
* stable-2.13:
Squash event class private fire() methods into public methods
GitReferenceUpdated: Remove redundant fire() methods
Fire events with Account rather than Account.Id
CreateProject: Use IdentifiedUser rather than CurrentUser
Reduce visibility of helper methods in event classes
Reduce log spam caused by event listener failures
Organize imports
init: Add a flag to force-delete the cache
SetAccess: fix updating/visiting project access rules 500 error
SetAccess: fix 500 error when no parameter `force` in access api
init: delete cache if not empty
GitReferenceUpdated: Declare listeners as DynamicSet
PatchSetApproval: Set tag in copy constructor
Change Ie393f194e ("Fire events with Account rather than Account.Id")
caused compilation errors in PostReviewers. This merge also updates
PostReviewers to pass a list of Account rather than Account.Id.
Change-Id: I44bc12509143800b60abd47d6e49b8f545bc269e
As the the cache may be stale during update, offer the option
to delete it during init.
The default is set to not delete the cache, so batch usage should
be safe.
Change-Id: I51cc6d8aeeed52d2e47aaea97cba625ee0d506fc