34016 Commits

Author SHA1 Message Date
David Pursehouse
546d1a3160 Merge branch 'stable-2.15'
* stable-2.15:
  Update revision of commit-message-length-plugin
  Improve warning when starting Gerrit JVM without OOM protection
  EventUtil: Improve event bus error logging
  Warning when starting Gerrit JVM without OOM protection
  cmd-index.txt: Fix anchors
  Update revision of commit-message-length-validator plugin

Change-Id: Ia7ffc5961ff5c445f44c35ef1cd88ccdb2af8ab6
2018-08-30 13:23:44 +09:00
David Pursehouse
c7c92466f6 SchemaCreatorTest: Fix varargs warning in assertion
Change I458b807dd introduced a warning:

  Type Integer[] of the last argument to method containsExactly(Object...)
  doesn't exactly match the vararg parameter type. Cast to Object[] to
  confirm the non-varargs invocation, or pass individual arguments of type
  Object for a varargs invocation.

Changing `containsExactly(range)` to `containsExactlyElementsIn(rangeList)`
fixes it.

Change-Id: I1febc7f30dba07faba60f8ee2191a0585637f5c8
2018-08-30 12:48:04 +09:00
David Pursehouse
5c78c2ddc8 Merge "Update dev-polygerrit.txt" 2018-08-30 01:30:50 +00:00
David Pursehouse
60325b70b2 Merge branch 'stable-2.14' into stable-2.15
* stable-2.14:
  Update revision of commit-message-length-plugin
  Improve warning when starting Gerrit JVM without OOM protection
  Warning when starting Gerrit JVM without OOM protection
  cmd-index.txt: Fix anchors
  Update revision of commit-message-length-validator plugin

Change-Id: I22e63acf594457e15dc1f922641998a72a6f577a
2018-08-30 10:20:15 +09:00
David Pursehouse
bcaab00342 Merge "Add short-cut to cut down on the number of permission checks" 2018-08-30 01:11:47 +00:00
David Pursehouse
dc89e04b46 Merge "Don't return the TestAccount on an account update" 2018-08-30 00:51:45 +00:00
David Pursehouse
1f6117db6f Merge changes Ia6fbc9e5,I611dde47
* changes:
  ReceiveCommits: warn about missing Change-Id
  ReceiveCommits: emit warning message for push to refs/changes
2018-08-30 00:46:55 +00:00
David Pursehouse
855176f65d Merge "Don't depend directly on the Maven Flogger jar" 2018-08-30 00:40:38 +00:00
David Pursehouse
a59c39a152 Update revision of commit-message-length-plugin
- Use "warning" prefix to allow colorization of remote output

Change-Id: Ic968dc5e894ae95f70f0e2b321745190b9c1093e
2018-08-30 08:21:31 +09:00
David Pursehouse
acf4e22463 Improve warning when starting Gerrit JVM without OOM protection
Change-Id: Ib4ab2d5ab6a58fa34de081d8051b21411f994e70
2018-08-30 08:19:53 +09:00
David Pursehouse
89ae77e970 Merge "EventUtil: Improve event bus error logging" into stable-2.15 2018-08-29 23:14:48 +00:00
Dave Borowitz
325e949587 Merge "Rewrite Inline Edit to describe new UI." 2018-08-29 21:35:22 +00:00
Dave Borowitz
ee513e7e56 Merge changes I4bef895e,I807f394d,I3652b2af,I80c8efd6,I458b807d, ...
* changes:
  LabelType: Use Optional#orElseThrow
  Simplify LabelType#sortValues
  LabelType: Make all collection fields unmodifiable
  LabelType: Eagerly populate byValue
  Inline LabelType#getValuesAsList
  Add test for populating LabelValues
2018-08-29 20:45:12 +00:00
David Ostrovsky
a208e2791c Merge "PolyGerrit: Expose error function in plugin rest API" 2018-08-29 20:35:43 +00:00
Edwin Kempin
8a475ab717 Don't depend directly on the Maven Flogger jar
Change-Id: Ic189e8686d96fd958b07d5c8e3f21885855b171b
Signed-off-by: Edwin Kempin <ekempin@google.com>
2018-08-29 21:35:46 +02:00
David Ostrovsky
a9675bab09 Merge changes Ib1b54eb7,Ib546f737
* changes:
  gr-repo-command: Add support for tooltips
  PolyGerrit-Plugin-API: Allow to disable custom element
2018-08-29 19:23:24 +00:00
David Ostrovsky
a4ac1abec0 PolyGerrit: Expose error function in plugin rest API
If user optionally pass error handling function to the send method of
rest API, request error can be processed in custom elements, e.g.:

  const errFn = response => {
    this.fire('page-error', {response});
  };
  return this.plugin.restApi().send(method, endpoint, body, errFn)
      .then(r => {
          Gerrit.Nav.navigateToRelativeUrl('/admin/repos');
      });

Considered alternative is to handle errors in plugin requests by
providing generic function that does the same: fire page-error event,
but having a way to provide custom error function is more flexible
approach.

Change-Id: Idd7e86dd0c40d53f4327c013fa0bb469ee8a6fff
2018-08-29 21:07:21 +02:00
Ole Rehmsen
f4fa9ff711 Merge "Move all server calls to gr-diff-host" 2018-08-29 18:50:21 +00:00
David Ostrovsky
aa04f13bdf gr-repo-command: Add support for tooltips
Project core and plugins actions exposing label and title. Label
supposed to be used as button name and title is supposed to be used
as button tooltip. Support for tooltip is added in this change. To make
minimal invasive change, we preserve title that was already taken as the
name of the button and add new tooltip attribute.

Alternative approach would be to consistently use label and title, like
it is done on change screen. However that approach may break some users,
that rely on current naming convention.

Note that this also fixed the problem for plugin authors. For example in
custom element in project screen, tooltip can be used as following:

    <gr-repo-command
        title="[[action.label]]"
        tooltip="[[action.title]]"
        on-command-tap="_handleCommandTap">
    </gr-repo-command>

Bug: Issue 9638
Change-Id: Ib1b54eb7cd4ba544402d293b9fce9bb176b01065
2018-08-29 20:12:43 +02:00
Dave Borowitz
9e8bcb2bfb LabelType: Use Optional#orElseThrow
Change-Id: I4bef895e61a0fe13774f569b68369961d3f3d8e2
2018-08-29 10:55:43 -07:00
Dave Borowitz
02ac9666dd Simplify LabelType#sortValues
Make a sorted copy with streams and lambdas. Use ArrayList#trimToSize
instead of writing extra logic to precompute the size.

Change-Id: I807f394de25493ae8a078a5bec45551d0c299e66
2018-08-29 10:55:43 -07:00
Dave Borowitz
2d347f63d7 LabelType: Make all collection fields unmodifiable
Defensively copy refPatterns. We still can't use Guava's immutable
collections in the GWT UI code.

Change-Id: I3652b2af957d10f8d88ef7200e608150d3203159
2018-08-29 10:54:51 -07:00
Ole Rehmsen
e5a40ecb38 Merge "Make gr-diff.reload() listen for render event" 2018-08-29 17:26:36 +00:00
Kasper Nilsson
d2e589cd1b Merge "Fixed some dark theme issues and made shell commands prettier" 2018-08-29 17:09:02 +00:00
Kasper Nilsson
76bcf56ddd Merge "Reset image styling when diff is re-rendered" 2018-08-29 17:00:41 +00:00
Dave Borowitz
aabba0a998 LabelType: Eagerly populate byValue
Lazily populating it adds complexity and is premature optimization.
LabelType#getValue is called by PostReview, so in the steady state the
byValue map would always be populated anyway.

Change-Id: I80c8efd64f88771bc60537a5b48eedda5cb23ee5
2018-08-29 09:44:14 -07:00
Dave Borowitz
f65dd49664 Inline LabelType#getValuesAsList
This method was unnecessarily complicated and had other issues:
* It was confusingly named, returning Integers rather than LabelValues
  as #getValues does.
* It stored its result in a transient field, even though it was never
  called more than once in its lifetime.
* It was only used by a single test method.

Simplify the LabelType class by moving this logic into a stream
expression in SchemaCreatorTest.

While we're in there, improve the assertions in assertValueRange:
* The input range doesn't need to be in reverse order.
* Check preconditions on the range argument.
* Use Collections.{min,max} instead of hard-coding indexes.
* Use StringSubject assertions instead of checking
  Strings#isNullOrEmpty, for better failure messages.

This method was confusingly named (it returned Integers, not
LabelValues) and was only used by a single test

Change-Id: I458b807dd5a4ae20048f18153cd6154589888fb3
2018-08-29 09:44:14 -07:00
Dave Borowitz
bee30034e6 Add test for populating LabelValues
Change-Id: I87908e6453d0a9080c8b1096ed973a41bd5e2a2a
2018-08-29 09:44:14 -07:00
Patrick Hiesel
41c99b3eb3 Add short-cut to cut down on the number of permission checks
This adds a short-cut to reduce the number of permission checks we have
to do in case the user has the permission to remove reviewers.

Change-Id: Iaadadf83bc852d0d31abbd2305f2a20537e30aed
2018-08-29 17:31:06 +02:00
Han-Wen Nienhuys
aee3fddab1 ReceiveCommits: warn about missing Change-Id
Change Ie5cd0c2b5d (commit d0c160bd18) marks the feature as
deprecated, but only in the documentation, which few people read.

Hopefully, people will notice the push messages.

Change-Id: Ia6fbc9e580e2c02b9264ed1bfe484e71d7d74199
2018-08-29 17:26:29 +02:00
Han-Wen Nienhuys
929fabd450 ReceiveCommits: emit warning message for push to refs/changes
Change-Id: I611dde47f621e06b0ec0bb887afd3963a45ac6ad
2018-08-29 16:53:33 +02:00
Sven Selberg
d2658d06c5 EventUtil: Improve event bus error logging
Exception#message is not always set. Add the Exception classname to
log message.

Change-Id: I7412fa15e686e50ad03f4cf65744cd105594600c
2018-08-29 14:50:51 +02:00
Han-Wen Nienhuys
ee987b1050 CommitValidators: trim "ERROR" shouting from "forge committer" check
Change-Id: I848e210da540524142b0e44f7e826cc0d0a7646b
2018-08-29 13:17:12 +02:00
Han-Wen Nienhuys
13411ff478 Update git submodules
* Update plugins/commit-message-length-validator from branch 'master'
  to 4f6b685e12e34a4f583cf84ba1c58ccc2b75e8b0
  - Use "warning" prefix to allow colorization of remote output
    
    Since commit bf1a11f "sideband: highlight keywords in remote sideband
    output" [1] in git, the "warning" keyword will be highlighted in the
    remote output when color.remote is enabled in the git config.
    
    Change "(W)" to "warning" to make use of this feature.
    
    Also make the messages a bit less verbose by removing "commit".
    
    [1] bf1a11f0a1
    
    Change-Id: I9d337af70fc12ddea356d361da23ce8f0bfa85a2
2018-08-29 11:11:02 +00:00
Ole Rehmsen
b1a7967be2 Move all server calls to gr-diff-host
This way gr-diff can be reused with a different server.

I decided to move tests concerning the server calls almost unchanged to
gr-diff-host, even when they reach into gr-diff and deeper to check if
certain things happened as a result of loading.

I added similar tests, minus the actual loading, back to gr-diff. This
results in a bit of duplicated test logic, because e.g. the rendering
is tested both in gr-diff and gr-diff-host. I think that is worth it to
reduce the likelihood I broke something.

Bug: Issue 9623
Change-Id: Ib460094eb8d5b8e856c0d7954ee801fa3b5946d3
2018-08-29 12:55:30 +02:00
Ole Rehmsen
ffb320ae65 Make gr-diff.reload() listen for render event
Before, it used the promise returned by the gr-diff-builder.render()
instead. Using the event is a prerequisite from moving away from
explicit render calls.

This comes with a small behavior change: Before, gr-diff would not
dispatch a `render` event when no rendering happened because prefs were
unset or the diff was too large and no safetyBypass was used. Now it
does because we still want reload to resolve the promise it returns.
This should not break anything though because currently only tests
listen for this event.

Bug: Issue 9623
Change-Id: I15dd07d706c21cb441f2bc597391e4620c9c12fc
2018-08-29 12:50:39 +02:00
David Pursehouse
ed711ec885 Merge "Warning when starting Gerrit JVM without OOM protection" into stable-2.14 2018-08-29 08:40:50 +00:00
Edwin Kempin
faf2c63ebf Merge "cmd-index.txt: Fix anchors" 2018-08-29 07:57:42 +00:00
Edwin Kempin
1a94ece825 Merge changes Icb4b8118,Ifa15bb97
* changes:
  user-request-tracing.txt: Add note to use tracing with care
  user-upload.txt: Simplify example to enable tracing on push
2018-08-29 07:29:23 +00:00
Luca Milanesio
727a856753 Warning when starting Gerrit JVM without OOM protection
When gerrit.sh gets started from a non-root user, the JVM PID is not
protected against the Kernel OOM killer attacks.
Instead of silently ignoring the setting, display a warning making aware
of the danger and telling the user what to do.

Bug: Issue 9514
Change-Id: I4c1c0e06b260e75d900f436d37f0b91d031cd24e
2018-08-29 07:19:50 +00:00
Edwin Kempin
373159da16 cmd-index.txt: Fix anchors
Links to the anchors are currently not working.

Change-Id: I43c41c4d04bc665a4fe846de2d8fbc5b77bf7a81
Signed-off-by: Edwin Kempin <ekempin@google.com>
2018-08-29 16:12:18 +09:00
Edwin Kempin
cf830d53c8 cmd-index.txt: Fix anchors
Links to the anchors are currently not working.

Change-Id: I43c41c4d04bc665a4fe846de2d8fbc5b77bf7a81
Signed-off-by: Edwin Kempin <ekempin@google.com>
2018-08-29 09:03:30 +02:00
David Pursehouse
d5f0b691f8 Update revision of commit-message-length-validator plugin
- Remove Buck based build
- Prefer using Splitter to String.split

Change-Id: Icf588a3f38713b379a0e3847752c5c5852273139
2018-08-29 15:50:57 +09:00
Edwin Kempin
c9ec77886d user-request-tracing.txt: Add note to use tracing with care
Since tracing consumes additional server resources discourage users from
tracing requests unnecessarily.

Change-Id: Icb4b81188d6e0e0071416537b1bfadf22e2836da
Signed-off-by: Edwin Kempin <ekempin@google.com>
2018-08-29 08:45:51 +02:00
Edwin Kempin
8b7376ba28 user-upload.txt: Simplify example to enable tracing on push
It is sufficient to set the trace push option as '-o trace' to enable
tracing. '-o trace=true' also works but requires more typing.

Change-Id: Ifa15bb978531a5ebaa7aaf34c79960407249387b
Signed-off-by: Edwin Kempin <ekempin@google.com>
2018-08-29 08:38:30 +02:00
Edwin Kempin
ac4b68caf1 Add debug logs for command line parameters that show up in trace
E.g. this will log the magic branch options that have been set on a push
if tracing is enabled.

We only log the parameter names since the values may contain sensitive
information which should not show up in logs.

Change-Id: I26b0c22307f912ad0dbaa13b62f6356d714f2c80
Signed-off-by: Edwin Kempin <ekempin@google.com>
2018-08-29 06:14:18 +00:00
Han-Wen Nienhuys
b8424a073d ReceiveCommits: uniformize commit validation error messages.
Before

  [abcdabc] missing subject; Change-Id must be in commit message
  footer

After

  commit abcdabc: missing subject; Change-Id must be in message
  footer

Change-Id: I15ca67fb591b0d237cb9217936853ec8dc706aaa
2018-08-29 12:48:24 +09:00
David Pursehouse
a93d5142ad Merge branch 'stable-2.15'
* stable-2.15:
  ElasticRestClientProvider: Make client field volatile
  AbstractElasticIndexer: Specify charset for InputStreamReader
  SshCommandsIT: Use immutable type for constant field declarations
  rest-api-config.txt: Fix monospace `plugin`

Change-Id: Ib03a5976e13887bae3bf44f0864459418ed8a4f5
2018-08-29 11:08:06 +09:00
David Pursehouse
50acf00ad7 Merge branch 'stable-2.14' into stable-2.15
* stable-2.14:
  ElasticRestClientProvider: Make client field volatile
  AbstractElasticIndexer: Specify charset for InputStreamReader
  SshCommandsIT: Use immutable type for constant field declarations
  rest-api-config.txt: Fix monospace `plugin`

Change-Id: I4dbc4d1876c10ec1cc79a490c86082aa46999163
2018-08-29 11:07:04 +09:00
David Pursehouse
63899d219e ElasticRestClientProvider: Make client field volatile
ErrorProne reports a warning [1] that double-checked locking on
non-volatile fields is unsafe.

[1] http://errorprone.info/bugpattern/DoubleCheckedLocking

Change-Id: I4277a4910bd93fab9f072323a69bbf19472eb590
2018-08-29 10:25:10 +09:00