2398 Commits

Author SHA1 Message Date
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
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 Ostrovsky
acb84e5a66 Merge "Re-introduce the cache-based listing by configuration" into stable-2.16 2019-02-22 15:03:20 +00: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
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
David Pursehouse
a172ef1aa3 Merge branch 'stable-2.15' into stable-2.16
* stable-2.15:
  ElasticContainer: Bump V7_0 test server to 7.0.0-beta1

Change-Id: I0f499e2dbc8fb44ee2f85a6faef4be3deec1315b
2019-02-19 08:24:52 +09:00
Orgad Shaneh
25daae72a1 Suggest --no-edit when Change-Id is missing
There is no reason to start the editor just for adding
Change-Id.

Change-Id: I2e3b093ab123d4a9d55736e6c2ad83a07a194f53
2019-02-18 13:58:04 +00:00
David Pursehouse
db46a86e38 Merge branch 'stable-2.15' into stable-2.16
* stable-2.15:
  gerrit.sh: Improve error message when JRE cannot be found
  PrologEnvironment#setPredicate: Reduce log level to DEBUG

Change-Id: I26703bd42f91a96dc985a2de8e90f93be78bdd63
2019-02-18 21:07:53 +09:00
David Pursehouse
10c1299c83 Merge changes If3aaa629,I01deaca3 into stable-2.16
* changes:
  PG: Make commitlink selection configurable and consistent
  Add config gerrit.primaryWeblinkName
2019-02-18 09:08:00 +00:00
Sven Selberg
e63e92d89e Add config gerrit.primaryWeblinkName
Add gerrit.primaryWeblinkName to ServerInfo.
Lets the UI know which is the preferred weblink in instances were
only one weblink can be used, for example in inline links.

Change-Id: I01deaca3418d5c0486e3f5ebabf10827d47c3631
2019-02-18 09:01:54 +00:00
David Pursehouse
9b728841fa Move *Op classes from c.g.g.s.restapi.change to c.g.g.s.change
The majority of these classes are already in the c.g.g.s.change package.

Change-Id: Ic62b9f05443e2cd5167bab28eed789ad9669618f
2019-02-15 09:47:07 +09:00
David Pursehouse
ccf646765e Merge branch 'stable-2.15' into stable-2.16
* stable-2.15:
  PrologEnvironment: Add logging of reduction limits

Change-Id: Ic2b91320fadc837c91b578db27d7d46b15eb0f9d
2019-02-14 19:49:53 +09:00
Edwin Kempin
d647534fe9 ListProjects: Fix log statements
With Flogger we must use '%s' as placeholder for parameters.

Signed-off-by: Edwin Kempin <ekempin@google.com>
Change-Id: I834c84516b86b7bdcf800ab06748da30babd9a4f
2019-02-11 16:31:07 +01:00
Patrick Hiesel
f843d8674e Mark DeletePrivate input as @Nullable
The documentation says that an input is not required. The code checks
for null values correctly, but the injection methods lack @Nullable
which makes Guice fail to create the object when null is passed to
the factory method.

Annotate the input object as @Nullable to fix this.

Change-Id: I0d424e45d6039fd4ad8386b6811b9134cd600dfd
2019-02-08 17:38:01 +09:00
Luca Milanesio
e3efc1f715 ListProjects: print projects list using secondary index
Render the list of projects to OutputStream leveraging the
projects secondary index instead of relying on the in-memory cache.

Change-Id: I864e1c3cd63b206c0f9dc76bbaa6de99ddfdc0d4
2019-02-08 17:22:20 +09:00
Luca Milanesio
5017ba50ce ListProjects: re-implement using secondary index
The GWT UI and other parts of Gerrit still rely on the in-memory
cache for rendering the project list.
This is the first step that moves some use-cases to the QueryProjects
engine: full list without filters and showing only the active and readonly
projects.

All other existing use-cases are still based on the in-memory
cache and are going to be addressed in the follow-up of this change.

With regards to filtering by project name substring, it is not
implemented on top of the secondary index because of Issue 10446.

Bug: Issue 10380
Change-Id: I8effed5f75bdf353d9b23a3d349009e5f0535186
2019-02-08 07:35:11 +00:00
David Pursehouse
3c52bf9f63 Use QueryProjects#apply without parameters
The apply(TopLevelResource) method doesn't actually use the given
resource parameter, and only exists to satisfy the interface of its
parent RestReadView.

A variant of the method without the TopLevelResource parameter was
added in change Ia8ded07a5. Modify callers to use that.

Change-Id: I15af0d1cb35750c8aec4b2f42339901c48332889
2019-02-08 13:30:42 +09:00
Luca Milanesio
1ff28f3138 Merge branch 'stable-2.15' into stable-2.16
* stable-2.15:
  Disable "prefer-promise-reject-errors" in eslint
  Set version to 2.15.10
  Daemon: Show status of slave and headless mode in 'ready' log
  Daemon: Don't install online reindexer in slave mode
  RevisionApi: Add method to list votes per revision
  ChangeJson#getApprovalInfo: Add @Nullable annotations
  cmd-review: Add another example to clarify review using change number and PS
  Update .mailmap
  Update cmd-review documentation
  Daemon: use regular binding for auditModule
  CommitValidators: trim "ERROR" shouting from "forge committer" check
  ReceiveCommits: uniformize commit validation error messages.
  Inline "Change-Id" string into error messages
  Always end the "Change-Id missing" error message with \n.
  Print only one hint about Change-Ids at a time
  Clean up Change-Id hint text
  CommitValidators: Replace indexOf calls with String#contains
  CommitValidators: Prefer using Splitter to String.split

Changes I0bfe06bd and I58f8a0e5 are intentionally omitted because
they do not apply to the structure of the stable-2.16 branch.

Change-Id: I711837f062aeefeafa3631601b0150448e879575
2019-02-08 00:59:03 +00:00
Luca Milanesio
e83dee7079 QueryProjects: introduce apply() without parameters
QueryProjects REST API does not depend on the resource passed
as input but purely on its query parameters.

Introduce an apply() method without parameters so that the
absence of dependency with the resource becomes more explicit.

Change-Id: Ia8ded07a56a00af15f1fa44679886f24d8eabdd9
2019-02-07 07:48:57 +00:00
Luca Milanesio
57bfaba1d0 LuceneProjectIndex: fix NPE when project disappeared on disk
Fix a NPE in the decoding of ProjectState to ProjectData when a project
is removed from disk while Gerrit is still running.

Change-Id: I9bbf4e88a3b41d677e17121d10f38d8f901b2e99
2019-02-05 22:59:16 +00:00
Luca Milanesio
6a130c17a2 Rely on GroupAuditService rather than its implementation
GroupAuditService is the interface to the underlying audit
system, while AuditService is the actual implementation.

Instead of directly injecting the implementation class, rely on
the interface and leave the association to AuditService to the
Guice binding.

This is useful because tests may want to replace, at times, the
actual implementation of the audit-trail with a fake in-memory
store.

Change-Id: I31bbb522fb974c2504635ccf1251287d4890af89
2019-02-05 20:34:22 +00:00
Luca Milanesio
73cbdac4d5 Index groups with in-memory test
Move the indexing of the initial groups when the
Gerrit server gets prepared and started.

Change-Id: Ida137c500426d6d5b32a938fcdfee947040f4a80
2019-02-05 11:57:56 +00:00
Luca Milanesio
baa9aeb0e6 Index projects with in-memory test
When running integration tests with in-memory repositories make
sure that they are all indexed in Lucene before starting the tests.
This enables the implementation of tests that can rely on a
consistent projects index to run.

Change-Id: I2e628e4555ed7faa24fff44a0d226b57b5ce9909
2019-02-05 07:49:38 +00:00
David Ostrovsky
712f699db9 ListChildProjects: Make settting recursive option chainable
Change-Id: I4ffa174cd8ba2b062cd230a8e116f45c65f58693
2019-02-04 20:22:14 +09:00
David Ostrovsky
d3039e7143 ListChildProjects: Add limit option
Change-Id: Ied90e49cec5c9b658ad65e7a8ab45f2ec5e03948
2019-02-04 20:22:05 +09:00
David Ostrovsky
ddd38f36dc ListChildProjects: Use parent predicate to find child projects
Change-Id: I4c51f0c3826a71ad4aec9246e07883741b95b7ff
2019-02-04 20:21:46 +09:00
David Ostrovsky
f358a748bb QueryProjects: Make setter methods chainable
Change-Id: I8544af6114d554b39d11358971fed77c1b0b8f6b
2019-02-04 09:22:40 +01:00
David Ostrovsky
30b0a80290 Project index: Add parent predicate
Enabling the search by parent enables the rewrite
of the ListChildProjects REST-API that extracts the children
of a project. Using the Lucene index avoids the full scan
of the ProjectCache and thus speedup the extraction and
reduce the JVM heap consumption.

Bug: Issue 10401
Change-Id: I568d6ba0e5a0bff391f57e2357de6d059d77fe5d
2019-02-02 22:54:33 +00:00
Paladox
22d300fc28 Merge branch 'stable-2.15' into stable-2.16
* stable-2.15:
  Elasticsearch: Support and use v6.6.0 for testing
  Adds <noscript> to PolyGerritIndexHtml.soy

Change-Id: I93e6121d3fbb97d3f6598131148d50c73db19704
2019-01-31 13:51:23 +00:00
Edwin Kempin
f70d14d2ac Fix sorting of results from Lucene for account, group and project index
The fields that are used for sorting must be added to the document. This
means the documents in the index must be all recomputed, hence we need
new index schema versions for the affected indexes.

The sorting that is done by Lucene for the account index must match the
sorting of accounts that is already done in QueryAccounts before
returning query results to clients. QueryAccounts sorts results by
fullname, preferred email and account ID. If Lucene would do a different
sorting limited queries may return wrong results. E.g. if there are 3
accounts, Foo (ID=1), Bar (ID=2) and Baz (ID=3), which are all matched
by a query for which the results are limited to 2, callers of
QueryAccounts expect Bar and Baz to be returned since QueryAccounts
promises sorting by fullname. If now Lucene would sort by account ID,
Lucene would find Foo and Bar, Baz would be skipped since it's over the
limit. These results are then handed over to QueryAccounts which does
sorting by name so that Bar and Foo are returned to the client. This
would be wrong since the caller expects Bar and Baz. It's a bit unclear
how this worked when Lucene was not doing proper sorting at all, maybe
it was just luck that the withLimit test succeeded before. As Lucene
does the sorting properly now, the sorting in QueryAccounts could be
removed, but since Lucene is not the only index implementation and other
index implementation may still have sorting issues we keep that sorting
in QueryAccounts for now.

Bug: Issue 10210
Change-Id: Ic59e4d330fe8c7198023ddbc2fa946cf5db80b63
Signed-off-by: Edwin Kempin <ekempin@google.com>
(cherry picked from commit 714f7d3c3f6540b6d52bc4a426476f692eae612c)
2019-01-23 21:24:05 +00:00
Paladox
ede7366156 Merge branch 'stable-2.15' into stable-2.16
* stable-2.15:
  Set version to 2.15.9
  ListProjects: Refactor to avoid excessive heap usage
  ListProjectsIT: Add test for parent candidates option

Change-Id: If133e258196163e0ce4c58fc9bcf38ef84485bb5
2019-01-22 23:20:05 +00:00
David Pursehouse
aa89f78aee Merge branch 'stable-2.15' into stable-2.16
* stable-2.15:
  Fix support for deleting branches (if you have can_delete)
  FileApi: Add a method to set a file's "reviewed" flag

Change-Id: I72b3ece539223452a8cd446825d20eacbb82f153
2019-01-22 13:17:39 +09:00
David Pursehouse
ec26f04606 Merge branch 'stable-2.15' into stable-2.16
* stable-2.15:
  Consume JGit artifacts from Maven Central
  Consume JGit artifacts from Maven Central
  gr-related-changes: Don't show "Same topic" for only one change
  RelatedChanges: Don't show "Same Topic" for only one change
  ChangeEditApi: Allow to set options on change edit detail request
  Add Javadoc to clarify behavior of {Accounts|Changes|Groups}#withOptions
  OnlineNoteDbMigrationIT: improve readability of some tests
  Update git submodules
  Add release notes for Gerrit v2.10.8
  Add release notes for Gerrit v2.9.5
  Set version to 2.13.12
  Set version to 2.12.9
  Set version to 2.11.12
  Set version to 2.10.8
  Set version to 2.9.5

Change-Id: Id02a8afc6e4e8d42b759ed2ea28a0926411ff2e8
2019-01-18 21:47:17 +09:00
David Pursehouse
dd55d5eeca Merge branch 'stable-2.15' into stable-2.16
* stable-2.15:
  Update git submodules
  migrate-to-note-db: add --skip-project option
  OnlineNoteDbMigrationIT: Reuse existing constant
  Fix '/' getting typed in search bar when pressed
  Encode project name in download commands
  ChangeEditApiImpl: Access non-Singleton change edit classes via Provider

Change-Id: I4bc088e0f43919b8fea1fface333247fb1a4b786
2019-01-16 15:27:58 +09:00
Dave Borowitz
7b8b18289c ProjectResetter: Avoid Repository#getAllRefs
Change-Id: I8714e0bda17a2fa0f7f439b6eb68b4c82c383b4a
2019-01-15 14:51:42 +09:00
David Pursehouse
df7dda58df AbstractDaemonTest: Avoid Repository#getAllRefs
Change-Id: I42a8db041c7763bd03284194ff2cb052309ff66b
2019-01-15 14:47:07 +09:00
Dave Borowitz
49b5276607 ChangeUtil: Remove javadoc references to deprecated JGit methods
The descriptions are detailed and accurate enough without this
historical note.

Change-Id: If942039c703e3fbd83a16875d083dc3513f50ccc
2019-01-15 14:25:19 +09:00
David Pursehouse
f4b7be549a Merge branch 'stable-2.15' into stable-2.16
* stable-2.15:
  ListChangesOption: Add missing word in Javadoc
  Update git submodules
  AccountIT#updateDisplayName: Rewrite to work with updated account manager
  AccountApiImpl: Fix message in exception
  RelatedChangeAndCommitInfo: Use default CommitInfo#toString
  Support Get Related in extension API
  CommitInfo: Use ToStringHelper
  CommitInfo: Handle root commits in toString()
  Implement equals/hashCode/toString in CommitInfo and friends
  Set version to 2.15.9-SNAPSHOT
  AccountIT: Disable failing updateDisplayName test

Change-Id: Id2c1ad86a3f5ebb62a932b02d315330ae7a11102
2019-01-15 14:15:02 +09:00
David Pursehouse
a32ed26e9a Merge branch 'stable-2.15' into stable-2.16
* stable-2.15:
  Set version to 2.15.8
  Upgrade JGit to 4.9.8.201812241815-r
  Set version to 2.14.18
  Revert "Fix the missing DB entry in Gerrit DB"
  Upgrade JGit to 4.7.7.201812240805-r
  maven_jar: Add repo.eclipse.org to supported repositories
  Upgrade JGit to 4.5.5.201812240535-r

Change-Id: I012c25d49b9c03e91404c3166f30fdb7f32810f5
2019-01-11 09:17:55 +09:00
David Pursehouse
df74d0d848 Merge branch 'stable-2.15' into stable-2.16
* stable-2.15:
  ChangeApi: Add method to list change reviewers

Change-Id: I257a2a37ac90e1a86cc0fa7590b7a891f6ddb529
2019-01-10 22:26:27 +09:00
David Pursehouse
1d53668145 Merge branch 'stable-2.15' into stable-2.16
* stable-2.15:
  Bazel: Automatically fix lint errors with buildifier 0.20.0
  Bazel: Fix more buildifier warnings
  Bazel: Automatically fix lint errors with buildifier 0.20.0
  Fix typo in documentation of edit preferences
  Bazel: Automatically fix lint errors with buildifier

Change-Id: I3400928e4dca65264715dca3c29729237934f042
2019-01-10 21:44:13 +09:00
Luca Milanesio
34a8bdc881 Revert "Temp fix for projects list ordering in PolyGerrit"
This reverts commit 719b2d1067a8d655222d70417310753c93ba2d21.

Reason for revert: Using the standard project list would
bring the performance back to v2.15. The cure is worse
than the illness.

Change-Id: Ic94ac6e944d13ca4bd167e63bc2a8f9942cf5b38
2019-01-09 21:19:53 +00:00
Han-Wen Nienhuys
673ead8d11 Merge "Mail: Use correct patch set when reading line from file" into stable-2.16 2019-01-08 19:12:46 +00:00
Orgad Shaneh
3c9f215f33 Mail: Use correct patch set when reading line from file
If you add a comment on PS1, but post your reply on PS2,
the text line in the email was taken from PS2, which can
have a completely different content for the same line.

Bug: Issue 4278
Change-Id: I88c6035e404582e96b621367d8b3f665f7828906
2019-01-08 18:15:43 +00:00
David Pursehouse
28b7ab6a4e Merge branch 'stable-2.15' into stable-2.16
* stable-2.15:
  EditInfo: Include the change edit ref
  Add missing documentation of base_patch_set_number in edit API

Change-Id: Ib005e971116f569d73e1019d2b3cd27f9ba3da32
2019-01-07 23:10:46 +09:00