3025 Commits

Author SHA1 Message Date
David Pursehouse
3fbdf98c9a Remove remnants of project-specific themes support
Project-specific themes were only implemented in the GWT UI, which has
been removed.

Remove the ThemeInfo entity, and no longer include the 'theme' field in
the ConfigInfo entity returned by the project config REST API endpoint.
This is a breaking change for any client that still uses that endpoint.

The custom site header HTML, footer HTML, and CSS files are still used
by login screens and the internally managed Gitweb server. Update the
theme documentation to mention this.

PolyGerrit has site-wide theme support, but it is not documented in the
existing config-themes.txt, and adding it is not within the scope of
this change.

Change-Id: Ibe824a9416fac65bd365407b8ce22e03515b5b52
2019-03-02 05:10:44 +00:00
David Pursehouse
cbb84d9aef Merge changes If23c598d,I5fd1a074
* changes:
  MergeUtil: Add debug logging to PluggableCommitMessageGenerator
  Expand acceptance tests for ChangeMessageModifiers
2019-03-01 22:15:34 +00:00
Dave Borowitz
4dbcfd2a06 MergeUtil: Add debug logging to PluggableCommitMessageGenerator
Change-Id: If23c598d9bbaa16d3fa056d8d656b4ab87a34470
2019-03-01 07:54:47 -08:00
David Pursehouse
8560a9cc3c Merge "Consistently use ChangeUtil#status" 2019-02-28 23:14:57 +00:00
David Pursehouse
aed5229dcf Merge "Use replace instead of replaceAll where regex is not needed" 2019-02-26 23:13:59 +00:00
David Pursehouse
1ad4cf8fe3 Merge "Implement RevisionNote#getOnlyEntity" 2019-02-26 14:25:03 +00:00
Saša Živkov
24e650d93a Use replace instead of replaceAll where regex is not needed
There seem to be an reoccurring mistake of using String.replaceAll
instead of the String.replace. The method names are misleading and one
may think that the replace method replaces only the first occurrence and
the replaceAll method replaces all occurrences.

Actually, both methods replace all occurrences. However, the replace
method interpretes the first parameter as the plain string while the
replaceAll method interpretes it as a regex. Using the replace method
when regex support is not needed improves both performance and
readability.

Change-Id: Iffed6aae4d7b541e4dc76e4b5bd20dcd8d5bad49
2019-02-26 14:32:55 +01:00
David Pursehouse
08672c368b Merge branch 'stable-2.16'
* stable-2.16:
  ChangeCleanupConfig: Remove unnecessary usage of regex in URL replacement
  AbandonIT: Add tests for changeCleanup.abandonMessage
  UrlFormatter#getChangeViewUrl: Remove @Nullable and simplify default implementation
  UrlFormatter#getSettingsUrl: Annotate section parameter as @Nullable
  MergeUtil: Include project name in "Reviewed-On" URL
  ChangeCleanupConfig: Inject UrlFormatter via DynamicItem
  Adjust more classes to inject UrlFormatter via DynamicItem
  Set version to 2.15.12-SNAPSHOT
  Set version to 2.15.11
  Allow LFS-over-SSH created auth pass through ContainerAuthFilter
  Upgrade elasticsearch-rest-client to 6.6.1
  ElasticContainer: Bump the test server version to 5.6.15

Change-Id: Ie90d450ddb16d165ed2d5ec91964d35b735214dd
2019-02-26 21:17:53 +09:00
Patrick Hiesel
903b23c118 Implement RevisionNote#getOnlyEntity
RevisionNote is currently only used with lists. For the checks plugin we
want to use it to represent a map. Therefore, offer a getOnlyEntity
method to make sure we always just deal with a single entity.

Change-Id: I15b93e2517ce2dd3d8a6c421d5d8e7ac04c28220
2019-02-26 10:00:03 +01:00
David Pursehouse
0f652022f0 ChangeCleanupConfig: Remove unnecessary usage of regex in URL replacement
Change-Id: If5f3a1ee2c28ee9f9b75b7a5b77018df3d2cdb74
Reported-by: Saša Živkov <zivkov@gmail.com>
2019-02-26 17:44:20 +09:00
David Pursehouse
76294ee83e UrlFormatter#getChangeViewUrl: Remove @Nullable and simplify default implementation
There are no longer any callers in core that pass null project to
this method. Remove the @Nullable annotation and simplify the default
implementation.

Change-Id: I4359527e0167712a9d68efe08eb86392daa38f13
2019-02-26 17:27:10 +09:00
David Pursehouse
56d17e9ead UrlFormatter#getSettingsUrl: Annotate section parameter as @Nullable
Change-Id: I7213240c7177cf217b590b866817c3fd3a7d3dab
2019-02-26 17:27:10 +09:00
David Pursehouse
5c25c04004 MergeUtil: Include project name in "Reviewed-On" URL
The method UrlFormatter#getChangeViewUrl has the @Nullable annotation
on the project argument, allowing the project name to be omitted from
the URL.

The URL used in the Reviewed-On footer, which is added to the detailed
commit message, is the only place that passes null for that parameter,
and as a result this is the only place in Gerrit where the change URL
does not include the project name.

Bug: Issue 10512
Change-Id: Ib6737af0a72adb7706caa20991780be71617dd24
2019-02-26 17:27:10 +09:00
David Pursehouse
0b3d333ca6 ChangeCleanupConfig: Inject UrlFormatter via DynamicItem
Since change I375245647 the UrlFormatter is bound as a DynamicItem,
so it should also be injected as such.

For this class we can't simply change the constructor parameter since
the UrlFormatter is not stored as a member but is used to initialise
the abandon message, which may have a $URL placeholder which is used
to replace with the actual URL provided by the UrlFormatter.

Change it so that the abandon message is initialized in the construcor
as before, but the replacement of the $URL placeholder is only done at
the time the message is needed.

Bug: Issue 10500
Change-Id: If4299276ec94402e8d2b806ad179e185e307d1ab
2019-02-26 17:27:10 +09:00
David Pursehouse
27daa2c652 Adjust more classes to inject UrlFormatter via DynamicItem
Since change I375245647 the UrlFormatter is bound as a DynamicItem,
so it should also be injected as such.

Adjust most remaining classes to do that. The only one remaining is
the ChangeCleanupConfig which requires slightly more invasive changes
and will be done in a separate commit.

Bug: Issue 10500
Change-Id: Ie9eeef11bd5ce63168bb339e22ee3062482ddd25
2019-02-26 17:27:10 +09:00
David Pursehouse
a193aee064 Merge branch 'stable-2.15' into stable-2.16
* stable-2.15:
  Set version to 2.15.12-SNAPSHOT
  Set version to 2.15.11
  Allow LFS-over-SSH created auth pass through ContainerAuthFilter
  Upgrade elasticsearch-rest-client to 6.6.1
  ElasticContainer: Bump the test server version to 5.6.15

Change-Id: I6a54f5b233cf9fa6053241b729cdd300f83dfdc9
2019-02-26 14:25:46 +09:00
Dave Borowitz
b2c77a09ad Merge "Add acceptance test for plugin URL bindings" 2019-02-25 16:00:06 +00:00
Dave Borowitz
2a6dee2f1f Add acceptance test for plugin URL bindings
For now, just tests a top-level binding under /plugins/X. Future tests
could check views bound in a RestApiModule under an existing collection,
but I wasn't able to get those working in this change.

These tests are in a separate class from the old
PluginsRestApiBindingsIT because they are really testing a different
type of endpoint: the former is about the remote admin endpoints, which
is different from actual plugin-provided endpoints. Rename
PluginsRestApiBindingsIT accordingly.

Change-Id: I71b82a14ded11cc77baf1313d82bc714f8602f67
2019-02-25 06:56:59 -08:00
Patrick Hiesel
e116015cf7 Merge changes I03f3e829,I5a722891,I0f92e09f,I539293a2,I7f6c1b91
* changes:
  Warn the user about private changes on submit
  Publish private changes when they get submitted through a Git push
  Move private changes tests from ChangeIT to PrivateChangeIT
  Inject ChangeMessageUtil into SetPrivateOp directly
  Publish private changes on submission
2019-02-25 12:29:29 +00:00
David Pursehouse
b4be95a3da Merge changes from topic "reverse-dns-lookup"
* changes:
  Disable gerrit.enableReverseDnsLookup by default
  Replace gerrit.disableReverseDnsLookup with gerrit.enableReverseDnsLookup
2019-02-25 08:36:58 +00:00
David Pursehouse
793525fd15 Disable gerrit.enableReverseDnsLookup by default
Using reverse DNS lookup by default can cause unexpected performance
issues when writing the ref log, because the hostname of the user's
client is looked up on every ref log creation. For example this can
add a noticable delay (around 5 seconds) when adding a code review label,
due to the ref update of the notedb metadata refs in git.

Change the default of gerrit.enableReverseDnsLookup to false so that
DNS lookup is by default disabled.

Reported-by: Roman Karlstetter <Roman.Karlstetter@ifta.com>
Change-Id: I68af8e545fc54ea0c3819454d81bb4c598f65e93
2019-02-25 17:07:34 +09:00
David Pursehouse
46a2f6cf4c Replace gerrit.disableReverseDnsLookup with gerrit.enableReverseDnsLookup
Having a configuration option 'disable' with default value 'false'
results in a double-negative meaning which can be confusing.

Replace this option with enableReverseDnsLookup, with default 'true',
which effectively results in the same default behavior when no value
is configured.

Rename the DisableReverseDnsLookup and DisableReverseDnsLookupProvider
classes accordingly.

Change-Id: I36a8be9474f58a0d1457850bb5fae2fa7cc08ee8
2019-02-25 11:01:53 +09:00
David Pursehouse
b5db9cc7e0 Merge branch 'stable-2.16'
* stable-2.16:
  Acceptance: set log threshold level for tests
  Re-introduce the cache-based listing by configuration

Change-Id: I6049c231690b98afd7a16fbb26f9a6004bc3a094
2019-02-25 09:57:13 +09:00
Luca Milanesio
a73d761b8a Acceptance: set log threshold level for tests
By default all acceptance tests start Gerrit in DEBUG level, which in
some cases may generate *a lot* of logs that may pollute the output
console and make troubleshooting very difficult.

Allow specific tests to customise the log level and reduce it to
a more acceptable level.

Sample use:

@LogThreshold(level = "INFO")
public class MyTest extends AbstractDaemonTest {

  @Test
  public void shouldJustWork() {
     // test code
  }
}

Change-Id: I2b0b8496de1a43de112ce5b5c427e3c8603d5d9e
2019-02-23 10:11:21 +01:00
David Pursehouse
0a1fc895d8 Merge "Merge branch 'stable-2.16'" 2019-02-23 07:03:21 +00:00
Dave Borowitz
c079ccd23a Move CommitSubject and ObjectIdSubject to git.testing package
They belong there right next to the JGit PushResultSubject, they were
just put in the wrong place initially.

Change-Id: Iaef009136888c813f1bd20b7988e4f59259e860e
2019-02-22 09:32:55 -08:00
David Ostrovsky
acb84e5a66 Merge "Re-introduce the cache-based listing by configuration" into stable-2.16 2019-02-22 15:03:20 +00:00
Patrick Hiesel
8fffeff0fa Rename 'comments' to 'entities' in generalized RevisionNote
Change-Id: I9c6300a0cc1f68d411927c72becccf7b98c7163a
2019-02-22 08:32:37 +01:00
Patrick Hiesel
5f8ba3d5c8 Merge "Make more of AbstractChangeNotes public for checks plugin" 2019-02-22 07:30:37 +00:00
Patrick Hiesel
b4fe84829d Merge "Allow RevisionNotes to be any type, not just Comments" 2019-02-22 07:30:29 +00:00
Patrick Hiesel
44d2a1fc31 Merge "Make RevisionNote public for checks plugin" 2019-02-22 07:29:30 +00:00
Patrick Hiesel
8074e7c2a0 Merge "Add PLUGIN_CHECKS as an option for @UsedAt" 2019-02-22 07:29:10 +00:00
David Pursehouse
980b1d9d59 Merge branch 'stable-2.16'
* stable-2.16:
  Update git submodules
  Update git submodules
  Update cmd-stream-events doc
  PG: Set diff line lenght to 72 for commit message
  Add support for 'base' in cherry pick dialog
  Update git submodules
  Update git submodules
  CommitValidators: Inject UrlFormatter via DynamicItem
  Allow omitting action in permission removal
  Fix support for ldap groups that contains spaces
  AccountIT: Extend assertKeyEquals to check that full key is included
  Fix GPG public key export

Change-Id: Ia5396777b9922d090088fea4c010d2f1c6179534
2019-02-22 11:40:50 +09:00
Dave Borowitz
54e407e051 Make more of AbstractChangeNotes public for checks plugin
Change-Id: Ie5758cd9d585d61b46ac3512f67b20755d6e93cc
2019-02-22 11:13:57 +09:00
Dave Borowitz
399134f939 Allow RevisionNotes to be any type, not just Comments
Change-Id: Iab28dd2a5950f2f6714bec7a8b7f93b0642e91b6
2019-02-22 11:13:52 +09:00
David Pursehouse
37e00e62ea Merge branch 'stable-2.15' into stable-2.16
* stable-2.15:
  AccountIT: Extend assertKeyEquals to check that full key is included
  Fix GPG public key export

Change-Id: I68c469722593a53b475144825673cb0e8e9708e7
2019-02-22 10:10:10 +09:00
Dave Borowitz
1f9e76eaca Make RevisionNote public for checks plugin
Change-Id: Id5870f6c9c8bd98f7a2ce94443c7c7e8fa52532e
2019-02-21 16:15:57 -08:00
Dave Borowitz
f7077c8745 Add PLUGIN_CHECKS as an option for @UsedAt
Change-Id: I09a0629f77d8543c4502722560a3965d4a066d5a
2019-02-21 14:07:44 -08:00
Dave Borowitz
5b33f03e5e ChangeQueryProcessor: Don't rescan plugins when sizing list
DynamicMap#plugins() creates a new TreeSet on every invocation. We were
just doing this to presize an ArrayList, which makes it seem like we
care about reducing allocations, but was probably actually increasing
allocations. Fortunately, we can just presize using the multimap we
already have. This also allows us to remove a redundant instance field.

Change-Id: Ie5998add61d4848e184a37f4f237da132802a00f
2019-02-21 11:01:57 -08:00
Dave Borowitz
0b1e2c7256 ChangeQueryProcessor: Make attributeFactoriesByPlugin immutable
This emphasizes to the reader that this map is not supposed to be
mutated after construction time.

It is tempting to store Extensions instead of constructing our own map.
However, repeatedly calling Extensions#get() could cause performance
problems. Leave a comment about why we aren't doing this.

Change-Id: I466b2c17ea1e1b8a9304c97a579cdd3184e033fc
2019-02-21 11:01:57 -08:00
Dave Borowitz
a3c2503433 ChangeQueryProcessor: Inline setupAttributeFactories
This method was definitely not safe to call multiple times, since it
would add duplicate entries to the mutable map stored in the instance
field. The map should really only be initialized once, during
construction.

Change-Id: I6cbb792adb6ae9dbec70df3f45586dc518faf913
2019-02-21 11:01:57 -08:00
Dave Borowitz
f72cce702f ChangeQueryProcessor: Log when plugin attributes can't be loaded
Debugging production problems is much more difficult when exceptions are
completely swallowed. At the same time, if a plugin fails on all inputs,
logging one entry for every change in a large query result set would be
terrible as well. Split the difference and log once a minute; Flogger
makes this very easy. We can always decide to come back later and
complexify it by logging e.g. once per plugin or per factory, but this
is dead simple and pretty quiet.

Change-Id: If512583aef10e48c745660c42f021837caeb2994
2019-02-21 11:01:57 -08:00
Dave Borowitz
737fb08e06 AbstractDaemonTest: Add method for temporarily installing plugin
A plugin is really just a name plus one or more module classes. We
already have the TestServerPlugin magic which is used by
LightweightPluginDaemonTest, so reuse that. The difference is that the
use case for this new method is for testing the plugin plumbing itself,
not testing a specific real-world plugin.

Change-Id: I3ca4eda806519ad9bdd653e0b5f897e69ed119af
2019-02-21 07:02:00 -08:00
Dave Borowitz
d4ae9752ea RefNames: Make parseShardedUuidFromRefPart public for plugins
Change-Id: I2ddb5cd7681cca4d7485b16c64f9ff4631fab2ee
2019-02-21 07:02:00 -08:00
Dave Borowitz
961dff6ec6 AbstractDaemonTest: Return default config from resetProjects
Subclasses that override resetProjects may want to add to the default
config, rather than recreating it all from scratch. Previously, the
default config was never exposed to subclasses. Now, they can get it via
super.resetProjects() (or not, as current implementors all prefer).

Change-Id: If116e5fce9e0fe0f826b66c1f84774660f20dec7
2019-02-21 07:02:00 -08:00
Dave Borowitz
4fe329670f Add Truth subject for JGit RevCommits
Change-Id: Iae208db9202a82fda45f650831786562e36a3a4f
2019-02-21 07:02:00 -08:00
Luca Milanesio
9225485fc5 Re-introduce the cache-based listing by configuration
Introduce a new global configuration parameter gerrit.listProjectsFromIndex
to control the ability to render the project list from the secondary
index or the in-memory cache.

By default, the legacy in-memory cache is used as engine.

NOTE: The legacy in-memory cache provides an unlimited list
      while the secondary index limit is defined by the global
      capability 'queryLimit' which is defaulted to 500 entries.

Change-Id: I3dc089c2b546ff78c6a5aea65b2d6a255b6e20e1
2019-02-20 15:09:16 +00:00
David Pursehouse
eb10cb814c CommitValidators: Inject UrlFormatter via DynamicItem
If a plugin gets CommitValidators injected, the plugin fails to
load with:

  No implementation for com.google.gerrit.server.config.UrlFormatter was bound.

Since change I375245647 the UrlFormatter is bound as a DynamicItem,
so it should also be injected as such.

Bug: Issue 10500
Change-Id: Ieabb12b2086f8f785c8013e62193c8b811e00500
2019-02-20 14:28:17 +09:00
Dave Borowitz
2ce268141a RetryHelper: Add action type for use by plugins
Allowing plugins to specify custom action types may be feasible, but at
a minimum requires changing the type of the metrics.

Change-Id: Ieb659c8e86f59085e57dbcb134e3582039025223
2019-02-19 18:33:54 -08:00
Dave Borowitz
63af804e07 RefNames: Make shardUuid public, for use in plugins
Change-Id: I0b12e274b0a1b3aec43d6645bd1f22cd8b63e825
2019-02-19 18:33:54 -08:00