diff --git a/ReleaseNotes/ReleaseNotes-2.10.8.txt b/ReleaseNotes/ReleaseNotes-2.10.8.txt new file mode 100644 index 0000000000..e7de0e1d29 --- /dev/null +++ b/ReleaseNotes/ReleaseNotes-2.10.8.txt @@ -0,0 +1,39 @@ +Release notes for Gerrit 2.10.8 +=============================== + +There are no schema changes from link:ReleaseNotes-2.10.7.html[2.10.7]. + +Download: +link:https://gerrit-releases.storage.googleapis.com/gerrit-2.10.8.war[ +https://gerrit-releases.storage.googleapis.com/gerrit-2.10.8.war] + +Bug Fixes +--------- + +* link:https://bugs.chromium.org/p/gerrit/issues/detail?id=10262[Issue 10262]: Fix validation of wants in git-upload-pack for protocol v0 stateless transports. ++ +See the following section for details. + +* Upgrade JGit to 4.5.5.201812240535-r. ++ +This upgrade includes several major versions since 4.0.0 used in Gerrit version 2.10.7. +Important fixes are summarized below. Please refer to the corresponding JGit release notes for full details. + +** link:https://projects.eclipse.org/projects/technology.jgit/releases/4.5.5[JGit 4.5.5]: link:https://bugs.chromium.org/p/gerrit/issues/detail?id=10262[Issue 10262]: Fix validation of wants in git-upload-pack for protocol v0 stateless transports. ++ +AdvertiseRefsHook was not called for git-upload-pack in protocol v0 stateless transports, meaning that wants were not validated and a user could fetch anything that is pointed to by any ref (using fetch-by-sha1), as long as they could guess the object name. + +** link:https://projects.eclipse.org/projects/technology.jgit/releases/4.5.4[JGit 4.5.4]: Fix LockFile semantics when running on NFS. ++ +Honor trustFolderStats also when reading packed-refs. + +** link:https://projects.eclipse.org/projects/technology.jgit/releases/4.5.3[JGit 4.5.3]: Fix exception handling for opening bitmap index files. + +** link:https://projects.eclipse.org/projects/technology.jgit/releases/4.5.2[JGit 4.5.2]: Fix pack marked as corrupted even if it isn’t. + +** link:https://projects.eclipse.org/projects/technology.jgit/releases/4.5.1[JGit 4.5.1]: Don’t remove Pack when FileNotFoundException is transient. + +** link:https://projects.eclipse.org/projects/technology.jgit/releases/4.1.0[JGit 4.1.0]: Handle stale NFS file handles on packed-refs file. ++ +Use java.io.File instead of NIO to check existence of loose objects in ObjectDirectory to speed up inserting of loose objects. +Reduce memory consumption when creating bitmaps during writing pack files. \ No newline at end of file diff --git a/ReleaseNotes/ReleaseNotes-2.9.5.txt b/ReleaseNotes/ReleaseNotes-2.9.5.txt new file mode 100644 index 0000000000..18c469c78e --- /dev/null +++ b/ReleaseNotes/ReleaseNotes-2.9.5.txt @@ -0,0 +1,67 @@ +Release notes for Gerrit 2.9.5 +============================== + +Download: +link:https://gerrit-releases.storage.googleapis.com/gerrit-2.9.5.war[ +https://gerrit-releases.storage.googleapis.com/gerrit-2.9.5.war] + +Important Notes +--------------- + +*WARNING:* There are no schema changes from +link:ReleaseNotes-2.9.4.html[2.9.4], but when upgrading from an existing site +that was initialized with Gerrit version 2.6 to version 2.9.1 the primary key +column order will be updated for some tables. It is therefore important to +upgrade the site with the `init` program, rather than only copying the .war file +over the existing one. + +It is recommended to run the `init` program in interactive mode. Warnings will +be suppressed in batch mode. + +---- + java -jar gerrit.war init -d site_path +---- + +Bug Fixes +--------- + +* link:https://bugs.chromium.org/p/gerrit/issues/detail?id=10262[Issue 10262]: Fix validation of wants in git-upload-pack for protocol v0 stateless transports. ++ +See the following section for details. + +* Upgrade JGit to 4.5.5.201812240535-r. ++ +This upgrade includes several major versions since 3.4.2 used in Gerrit version 2.9.4. Important fixes are summarized below. Please refer to the corresponding JGit release notes for full details. + +** link:https://projects.eclipse.org/projects/technology.jgit/releases/4.5.5[JGit 4.5.5]: link:https://bugs.chromium.org/p/gerrit/issues/detail?id=10262[Issue 10262]: Fix validation of wants in git-upload-pack for protocol v0 stateless transports. ++ +AdvertiseRefsHook was not called for git-upload-pack in protocol v0 stateless transports, meaning that wants were not validated and a user could fetch anything that is pointed to by any ref (using fetch-by-sha1), as long as they could guess the object name. + +** link:https://projects.eclipse.org/projects/technology.jgit/releases/4.5.4[JGit 4.5.4]: Fix LockFile semantics when running on NFS. ++ +Honor trustFolderStats also when reading packed-refs. + +** link:https://projects.eclipse.org/projects/technology.jgit/releases/4.5.3[JGit 4.5.3]: Fix exception handling for opening bitmap index files. + +** link:https://projects.eclipse.org/projects/technology.jgit/releases/4.5.2[JGit 4.5.2]: Fix pack marked as corrupted even if it isn’t. + +** link:https://projects.eclipse.org/projects/technology.jgit/releases/4.5.1[JGit 4.5.1]: Don’t remove Pack when FileNotFoundException is transient. + +** link:https://projects.eclipse.org/projects/technology.jgit/releases/4.1.0[JGit 4.1.0]: Handle stale NFS file handles on packed-refs file. ++ +Use java.io.File instead of NIO to check existence of loose objects in ObjectDirectory to speed up inserting of loose objects. +Reduce memory consumption when creating bitmaps during writing pack files. + +** link:https://projects.eclipse.org/projects/technology.jgit/releases/3.7.1[JGit 3.7.1]: Fix massive performance problem in Gerrit caused by ObjectWalk.markUninteresting marking the root tree as uninteresting. + +** link:https://projects.eclipse.org/projects/technology.jgit/releases/3.7.0[JGit 3.7.0]: Provide more details in exceptions thrown when packfile is invalid. + +** link:https://projects.eclipse.org/projects/technology.jgit/releases/3.6.2[JGit 3.6.2]: link:[Issue 3094]: Don’t remove pack from pack list for problems which could be transient. ++ +Log reason for ignoring pack when IOException occurred. + +** link:https://projects.eclipse.org/projects/technology.jgit/releases/3.5.3[JGit 3.5.3]: Fix for vulnerability CVE-2014-9390. + +* Fix resource exhaustion due to unclosed LDAP connection. ++ +When auth.type is set to LDAP (not LDAP_BIND), two LDAP connections are made, but one was not being closed. This eventually caused resource exhaustion and LDAP authentications failed. diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/RelatedChanges.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/RelatedChanges.java index 96bbe615bd..2c52800231 100644 --- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/RelatedChanges.java +++ b/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/RelatedChanges.java @@ -233,9 +233,13 @@ public class RelatedChanges extends TabPanel { if (!Gerrit.info().change().isSubmitWholeTopicEnabled() && info.topic() != null && !"".equals(info.topic())) { - StringBuilder topicQuery = new StringBuilder(); - topicQuery.append("status:open"); - topicQuery.append(" ").append(op("topic", info.topic())); + StringBuilder topicQuery = + new StringBuilder() + .append("status:open") + .append(" ") + .append(op("-change", info.legacyId().get())) + .append(" ") + .append(op("topic", info.topic())); ChangeList.query( topicQuery.toString(), EnumSet.of( diff --git a/java/com/google/gerrit/extensions/api/accounts/Accounts.java b/java/com/google/gerrit/extensions/api/accounts/Accounts.java index 651e786fe8..db7f506e9f 100644 --- a/java/com/google/gerrit/extensions/api/accounts/Accounts.java +++ b/java/com/google/gerrit/extensions/api/accounts/Accounts.java @@ -172,16 +172,19 @@ public interface Accounts { return this; } + /** Set an option on the request, appending to existing options. */ public QueryRequest withOption(ListAccountsOption options) { this.options.add(options); return this; } + /** Set options on the request, appending to existing options. */ public QueryRequest withOptions(ListAccountsOption... options) { this.options.addAll(Arrays.asList(options)); return this; } + /** Set options on the request, replacing existing options. */ public QueryRequest withOptions(EnumSet options) { this.options = options; return this; diff --git a/java/com/google/gerrit/extensions/api/changes/ChangeEditApi.java b/java/com/google/gerrit/extensions/api/changes/ChangeEditApi.java index 9d0275ac19..25eb7a83a3 100644 --- a/java/com/google/gerrit/extensions/api/changes/ChangeEditApi.java +++ b/java/com/google/gerrit/extensions/api/changes/ChangeEditApi.java @@ -14,11 +14,13 @@ package com.google.gerrit.extensions.api.changes; +import com.google.gerrit.extensions.client.ChangeEditDetailOption; import com.google.gerrit.extensions.common.EditInfo; import com.google.gerrit.extensions.restapi.BinaryResult; import com.google.gerrit.extensions.restapi.NotImplementedException; import com.google.gerrit.extensions.restapi.RawInput; import com.google.gerrit.extensions.restapi.RestApiException; +import java.util.EnumSet; import java.util.Optional; /** @@ -29,6 +31,33 @@ import java.util.Optional; */ public interface ChangeEditApi { + abstract class ChangeEditDetailRequest { + private String base; + private EnumSet options = EnumSet.noneOf(ChangeEditDetailOption.class); + + public abstract Optional get() throws RestApiException; + + public ChangeEditDetailRequest withBase(String base) { + this.base = base; + return this; + } + + public ChangeEditDetailRequest withOption(ChangeEditDetailOption option) { + this.options.add(option); + return this; + } + + public String getBase() { + return base; + } + + public EnumSet options() { + return options; + } + } + + ChangeEditDetailRequest detail() throws RestApiException; + /** * Retrieves details regarding the change edit. * @@ -155,6 +184,11 @@ public interface ChangeEditApi { * interface. */ class NotImplemented implements ChangeEditApi { + @Override + public ChangeEditDetailRequest detail() throws RestApiException { + throw new NotImplementedException(); + } + @Override public Optional get() throws RestApiException { throw new NotImplementedException(); diff --git a/java/com/google/gerrit/extensions/api/changes/Changes.java b/java/com/google/gerrit/extensions/api/changes/Changes.java index 0708ef5dc9..dc0a250174 100644 --- a/java/com/google/gerrit/extensions/api/changes/Changes.java +++ b/java/com/google/gerrit/extensions/api/changes/Changes.java @@ -94,16 +94,19 @@ public interface Changes { return this; } + /** Set an option on the request, appending to existing options. */ public QueryRequest withOption(ListChangesOption options) { this.options.add(options); return this; } + /** Set options on the request, appending to existing options. */ public QueryRequest withOptions(ListChangesOption... options) { this.options.addAll(Arrays.asList(options)); return this; } + /** Set options on the request, replacing existing options. */ public QueryRequest withOptions(EnumSet options) { this.options = options; return this; diff --git a/java/com/google/gerrit/extensions/api/groups/Groups.java b/java/com/google/gerrit/extensions/api/groups/Groups.java index 0243ba3bf0..86c2d772fb 100644 --- a/java/com/google/gerrit/extensions/api/groups/Groups.java +++ b/java/com/google/gerrit/extensions/api/groups/Groups.java @@ -253,16 +253,19 @@ public interface Groups { return this; } + /** Set an option on the request, appending to existing options. */ public QueryRequest withOption(ListGroupsOption options) { this.options.add(options); return this; } + /** Set options on the request, appending to existing options. */ public QueryRequest withOptions(ListGroupsOption... options) { this.options.addAll(Arrays.asList(options)); return this; } + /** Set options on the request, replacing existing options. */ public QueryRequest withOptions(EnumSet options) { this.options = options; return this; diff --git a/java/com/google/gerrit/extensions/client/ChangeEditDetailOption.java b/java/com/google/gerrit/extensions/client/ChangeEditDetailOption.java new file mode 100644 index 0000000000..156b76883a --- /dev/null +++ b/java/com/google/gerrit/extensions/client/ChangeEditDetailOption.java @@ -0,0 +1,20 @@ +// Copyright (C) 2019 The Android Open Source Project +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package com.google.gerrit.extensions.client; + +public enum ChangeEditDetailOption { + LIST_FILES, + DOWNLOAD_COMMANDS +} diff --git a/java/com/google/gerrit/server/api/changes/ChangeEditApiImpl.java b/java/com/google/gerrit/server/api/changes/ChangeEditApiImpl.java index 8b9ffaf262..5aa4cf13ad 100644 --- a/java/com/google/gerrit/server/api/changes/ChangeEditApiImpl.java +++ b/java/com/google/gerrit/server/api/changes/ChangeEditApiImpl.java @@ -18,6 +18,7 @@ import static com.google.gerrit.server.api.ApiUtil.asRestApiException; import com.google.gerrit.extensions.api.changes.ChangeEditApi; import com.google.gerrit.extensions.api.changes.PublishChangeEditInput; +import com.google.gerrit.extensions.client.ChangeEditDetailOption; import com.google.gerrit.extensions.common.EditInfo; import com.google.gerrit.extensions.common.Input; import com.google.gerrit.extensions.restapi.AuthException; @@ -86,6 +87,34 @@ public class ChangeEditApiImpl implements ChangeEditApi { this.changeResource = changeResource; } + @Override + public ChangeEditDetailRequest detail() throws RestApiException { + try { + return new ChangeEditDetailRequest() { + @Override + public Optional get() throws RestApiException { + return ChangeEditApiImpl.this.get(this); + } + }; + } catch (Exception e) { + throw asRestApiException("Cannot retrieve change edit", e); + } + } + + private Optional get(ChangeEditDetailRequest r) throws RestApiException { + try { + ChangeEdits.Detail editDetail = editDetailProvider.get(); + editDetail.setBase(r.getBase()); + editDetail.setList(r.options().contains(ChangeEditDetailOption.LIST_FILES)); + editDetail.setDownloadCommands( + r.options().contains(ChangeEditDetailOption.DOWNLOAD_COMMANDS)); + Response edit = editDetail.apply(changeResource); + return edit.isNone() ? Optional.empty() : Optional.of(edit.value()); + } catch (Exception e) { + throw asRestApiException("Cannot retrieve change edit", e); + } + } + @Override public Optional get() throws RestApiException { try { diff --git a/java/com/google/gerrit/server/restapi/change/ChangeEdits.java b/java/com/google/gerrit/server/restapi/change/ChangeEdits.java index 0b1651dd05..cabb30df7b 100644 --- a/java/com/google/gerrit/server/restapi/change/ChangeEdits.java +++ b/java/com/google/gerrit/server/restapi/change/ChangeEdits.java @@ -151,14 +151,24 @@ public class ChangeEdits implements ChildCollection maybeEditInfo = gApi.changes().id(changeId).edit().get(); + assertThat(maybeEditInfo).isPresent(); + EditInfo editInfo = maybeEditInfo.get(); ChangeInfo changeInfo = get(changeId, CURRENT_REVISION, CURRENT_COMMIT); assertThat(editInfo.commit.commit).isNotEqualTo(changeInfo.currentRevision); assertThat(editInfo).commit().parents().hasSize(1); @@ -431,11 +434,7 @@ public class ChangeEditIT extends AbstractDaemonTest { @Test public void retrieveFilesInEdit() throws Exception { createEmptyEditFor(changeId); - gApi.changes().id(changeId).edit().modifyFile(FILE_NAME, RawInputUtil.create(CONTENT_NEW)); - - EditInfo info = getEditInfo(changeId, true); - assertThat(info.files).isNotNull(); - assertThat(info.files.keySet()).containsExactly(Patch.COMMIT_MSG, FILE_NAME, FILE_NAME2); + assertFiles(changeId, ImmutableList.of(COMMIT_MSG, FILE_NAME, FILE_NAME2)); } @Test @@ -576,8 +575,10 @@ public class ChangeEditIT extends AbstractDaemonTest { @Test public void addNewFile() throws Exception { createEmptyEditFor(changeId); + assertFiles(changeId, ImmutableList.of(COMMIT_MSG, FILE_NAME, FILE_NAME2)); gApi.changes().id(changeId).edit().modifyFile(FILE_NAME3, RawInputUtil.create(CONTENT_NEW)); ensureSameBytes(getFileContentOfEdit(changeId, FILE_NAME3), CONTENT_NEW); + assertFiles(changeId, ImmutableList.of(COMMIT_MSG, FILE_NAME, FILE_NAME2, FILE_NAME3)); } @Test @@ -785,6 +786,19 @@ public class ChangeEditIT extends AbstractDaemonTest { assertThat(fileContent).value().bytes().isEqualTo(expectedFileBytes); } + private void assertFiles(String changeId, List expected) throws Exception { + Optional info = + gApi.changes() + .id(changeId) + .edit() + .detail() + .withOption(ChangeEditDetailOption.LIST_FILES) + .get(); + assertThat(info).isPresent(); + assertThat(info.get().files).isNotNull(); + assertThat(info.get().files.keySet()).containsExactlyElementsIn(expected); + } + private String urlEdit(String changeId) { return "/changes/" + changeId + "/edit"; } @@ -801,10 +815,6 @@ public class ChangeEditIT extends AbstractDaemonTest { return urlEdit(changeId) + "/" + fileName + (base ? "?base" : ""); } - private String urlGetFiles(String changeId) { - return urlEdit(changeId) + "?list"; - } - private String urlRevisionFiles(String changeId, String revisionId) { return "/changes/" + changeId + "/revisions/" + revisionId + "/files"; } @@ -839,11 +849,6 @@ public class ChangeEditIT extends AbstractDaemonTest { + "/diff?context=ALL&intraline"; } - private EditInfo getEditInfo(String changeId, boolean files) throws Exception { - RestResponse r = adminRestSession.get(files ? urlGetFiles(changeId) : urlEdit(changeId)); - return readContentFromJson(r, EditInfo.class); - } - private T readContentFromJson(RestResponse r, Class clazz) throws Exception { r.assertOK(); try (JsonReader jsonReader = new JsonReader(r.getReader())) { diff --git a/javatests/com/google/gerrit/acceptance/server/notedb/OnlineNoteDbMigrationIT.java b/javatests/com/google/gerrit/acceptance/server/notedb/OnlineNoteDbMigrationIT.java index 468e8103d5..c2499737d9 100644 --- a/javatests/com/google/gerrit/acceptance/server/notedb/OnlineNoteDbMigrationIT.java +++ b/javatests/com/google/gerrit/acceptance/server/notedb/OnlineNoteDbMigrationIT.java @@ -63,6 +63,7 @@ import com.google.gerrit.server.notedb.rebuild.NotesMigrationStateListener; import com.google.gerrit.server.schema.ReviewDbFactory; import com.google.gerrit.testing.ConfigSuite; import com.google.gerrit.testing.NoteDbMode; +import com.google.gwtorm.server.OrmException; import com.google.gwtorm.server.SchemaFactory; import com.google.inject.Inject; import com.google.inject.Provider; @@ -294,23 +295,10 @@ public class OnlineNoteDbMigrationIT extends AbstractDaemonTest { Change.Id id1 = r1.getChange().getId(); Change.Id id2 = r2.getChange().getId(); - try (ReviewDb db = schemaFactory.open()) { - Change c1 = db.changes().get(id1); - c1.setNoteDbState(INVALID_STATE); - Change c2 = db.changes().get(id2); - c2.setNoteDbState(INVALID_STATE); - db.changes().update(ImmutableList.of(c1, c2)); - } - + invalidateNoteDbState(id1, id2); migrate(b -> b.setChanges(ImmutableList.of(id2)), NoteDbMigrator::rebuild); - - try (ReviewDb db = schemaFactory.open()) { - NoteDbChangeState s1 = NoteDbChangeState.parse(db.changes().get(id1)); - assertThat(s1.getChangeMetaId().name()).isEqualTo(INVALID_STATE); - - NoteDbChangeState s2 = NoteDbChangeState.parse(db.changes().get(id2)); - assertThat(s2.getChangeMetaId().name()).isNotEqualTo(INVALID_STATE); - } + assertNotRebuilt(id1); + assertRebuilt(id2); } @Test @@ -325,23 +313,10 @@ public class OnlineNoteDbMigrationIT extends AbstractDaemonTest { Change.Id id1 = r1.getChange().getId(); Change.Id id2 = r2.getChange().getId(); - try (ReviewDb db = schemaFactory.open()) { - Change c1 = db.changes().get(id1); - c1.setNoteDbState(INVALID_STATE); - Change c2 = db.changes().get(id2); - c2.setNoteDbState(INVALID_STATE); - db.changes().update(ImmutableList.of(c1, c2)); - } - + invalidateNoteDbState(id1, id2); migrate(b -> b.setProjects(ImmutableList.of(p2)), NoteDbMigrator::rebuild); - - try (ReviewDb db = schemaFactory.open()) { - NoteDbChangeState s1 = NoteDbChangeState.parse(db.changes().get(id1)); - assertThat(s1.getChangeMetaId().name()).isEqualTo(INVALID_STATE); - - NoteDbChangeState s2 = NoteDbChangeState.parse(db.changes().get(id2)); - assertThat(s2.getChangeMetaId().name()).isNotEqualTo(INVALID_STATE); - } + assertNotRebuilt(id1); + assertRebuilt(id2); } @Test @@ -360,27 +335,39 @@ public class OnlineNoteDbMigrationIT extends AbstractDaemonTest { Change.Id id2 = r2.getChange().getId(); Change.Id id3 = r3.getChange().getId(); - try (ReviewDb db = schemaFactory.open()) { - Change c1 = db.changes().get(id1); - c1.setNoteDbState(INVALID_STATE); - Change c2 = db.changes().get(id2); - c2.setNoteDbState(INVALID_STATE); - Change c3 = db.changes().get(id3); - c3.setNoteDbState(INVALID_STATE); - db.changes().update(ImmutableList.of(c1, c2, c3)); - } - + invalidateNoteDbState(id1, id2, id3); migrate(b -> b.setSkipProjects(ImmutableList.of(p3)), NoteDbMigrator::rebuild); + assertRebuilt(id1, id2); + assertNotRebuilt(id3); + } + private void invalidateNoteDbState(Change.Id... ids) throws OrmException { + List list = new ArrayList<>(ids.length); try (ReviewDb db = schemaFactory.open()) { - NoteDbChangeState s1 = NoteDbChangeState.parse(db.changes().get(id1)); - assertThat(s1.getChangeMetaId().name()).isNotEqualTo(INVALID_STATE); + for (Change.Id id : ids) { + Change c = db.changes().get(id); + c.setNoteDbState(INVALID_STATE); + list.add(c); + } + db.changes().update(list); + } + } - NoteDbChangeState s2 = NoteDbChangeState.parse(db.changes().get(id2)); - assertThat(s2.getChangeMetaId().name()).isNotEqualTo(INVALID_STATE); + private void assertRebuilt(Change.Id... ids) throws OrmException { + try (ReviewDb db = schemaFactory.open()) { + for (Change.Id id : ids) { + NoteDbChangeState s = NoteDbChangeState.parse(db.changes().get(id)); + assertThat(s.getChangeMetaId().name()).isNotEqualTo(INVALID_STATE); + } + } + } - NoteDbChangeState s3 = NoteDbChangeState.parse(db.changes().get(id3)); - assertThat(s3.getChangeMetaId().name()).isEqualTo(INVALID_STATE); + private void assertNotRebuilt(Change.Id... ids) throws OrmException { + try (ReviewDb db = schemaFactory.open()) { + for (Change.Id id : ids) { + NoteDbChangeState s = NoteDbChangeState.parse(db.changes().get(id)); + assertThat(s.getChangeMetaId().name()).isEqualTo(INVALID_STATE); + } } } diff --git a/lib/jgit/jgit.bzl b/lib/jgit/jgit.bzl index 29b0fe5972..76c7e64091 100644 --- a/lib/jgit/jgit.bzl +++ b/lib/jgit/jgit.bzl @@ -1,4 +1,4 @@ -load("//tools/bzl:maven_jar.bzl", "ECLIPSE", "maven_jar") +load("//tools/bzl:maven_jar.bzl", "MAVEN_CENTRAL", "maven_jar") _JGIT_VERS = "5.1.5.201812261915-r" @@ -6,7 +6,7 @@ _DOC_VERS = _JGIT_VERS # Set to _JGIT_VERS unless using a snapshot JGIT_DOC_URL = "http://download.eclipse.org/jgit/site/" + _DOC_VERS + "/apidocs" -_JGIT_REPO = ECLIPSE # Leave here even if set to MAVEN_CENTRAL. +_JGIT_REPO = MAVEN_CENTRAL # Leave here even if set to MAVEN_CENTRAL. # set this to use a local version. # "/home//projects/jgit" diff --git a/polygerrit-ui/app/elements/change/gr-related-changes-list/gr-related-changes-list.js b/polygerrit-ui/app/elements/change/gr-related-changes-list/gr-related-changes-list.js index 39f4d8dab6..6c475892ae 100644 --- a/polygerrit-ui/app/elements/change/gr-related-changes-list/gr-related-changes-list.js +++ b/polygerrit-ui/app/elements/change/gr-related-changes-list/gr-related-changes-list.js @@ -190,7 +190,8 @@ }, _getChangesWithSameTopic() { - return this.$.restAPI.getChangesWithSameTopic(this.change.topic); + return this.$.restAPI.getChangesWithSameTopic(this.change.topic, + this.change._number); }, /** diff --git a/polygerrit-ui/app/elements/shared/gr-rest-api-interface/gr-rest-api-interface.js b/polygerrit-ui/app/elements/shared/gr-rest-api-interface/gr-rest-api-interface.js index 1274a905d4..65f1f40f10 100644 --- a/polygerrit-ui/app/elements/shared/gr-rest-api-interface/gr-rest-api-interface.js +++ b/polygerrit-ui/app/elements/shared/gr-rest-api-interface/gr-rest-api-interface.js @@ -1886,16 +1886,21 @@ }); }, - getChangesWithSameTopic(topic) { + getChangesWithSameTopic(topic, changeNum) { const options = this.listChangesOptionsToHex( this.ListChangesOption.LABELS, this.ListChangesOption.CURRENT_REVISION, this.ListChangesOption.CURRENT_COMMIT, this.ListChangesOption.DETAILED_LABELS ); + const query = [ + 'status:open', + '-change:' + changeNum, + 'topic:' + topic, + ].join(' '); const params = { O: options, - q: 'status:open topic:' + topic, + q: query, }; return this._fetchJSON({ url: '/changes/',