From 75da13df3ecabbfdbe631b2e8a87cf8699c907ba Mon Sep 17 00:00:00 2001 From: David Pursehouse Date: Wed, 16 Oct 2019 11:27:56 +0900 Subject: [PATCH 1/8] Set version to 2.14.21-SNAPSHOT We don't intend to release 2.14.21; this change is only so that building and deploying the API and WAR locally doesn't overwrite the officially released 2.14.20 versions. Change-Id: Ib893db7e7af6ba1a92a6d3d66fdb248463541756 --- gerrit-acceptance-framework/pom.xml | 2 +- gerrit-extension-api/pom.xml | 2 +- gerrit-plugin-api/pom.xml | 2 +- gerrit-plugin-gwtui/pom.xml | 2 +- gerrit-war/pom.xml | 2 +- version.bzl | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/gerrit-acceptance-framework/pom.xml b/gerrit-acceptance-framework/pom.xml index b1ae2644fe..bdfbbaf8b0 100644 --- a/gerrit-acceptance-framework/pom.xml +++ b/gerrit-acceptance-framework/pom.xml @@ -2,7 +2,7 @@ 4.0.0 com.google.gerrit gerrit-acceptance-framework - 2.14.20 + 2.14.21-SNAPSHOT jar Gerrit Code Review - Acceptance Test Framework Framework for Gerrit's acceptance tests diff --git a/gerrit-extension-api/pom.xml b/gerrit-extension-api/pom.xml index 4d156c68ca..7de992f63e 100644 --- a/gerrit-extension-api/pom.xml +++ b/gerrit-extension-api/pom.xml @@ -2,7 +2,7 @@ 4.0.0 com.google.gerrit gerrit-extension-api - 2.14.20 + 2.14.21-SNAPSHOT jar Gerrit Code Review - Extension API API for Gerrit Extensions diff --git a/gerrit-plugin-api/pom.xml b/gerrit-plugin-api/pom.xml index 630fb6c16e..3f8eb24b31 100644 --- a/gerrit-plugin-api/pom.xml +++ b/gerrit-plugin-api/pom.xml @@ -2,7 +2,7 @@ 4.0.0 com.google.gerrit gerrit-plugin-api - 2.14.20 + 2.14.21-SNAPSHOT jar Gerrit Code Review - Plugin API API for Gerrit Plugins diff --git a/gerrit-plugin-gwtui/pom.xml b/gerrit-plugin-gwtui/pom.xml index 8da9000817..025b59cba6 100644 --- a/gerrit-plugin-gwtui/pom.xml +++ b/gerrit-plugin-gwtui/pom.xml @@ -2,7 +2,7 @@ 4.0.0 com.google.gerrit gerrit-plugin-gwtui - 2.14.20 + 2.14.21-SNAPSHOT jar Gerrit Code Review - Plugin GWT UI Common Classes for Gerrit GWT UI Plugins diff --git a/gerrit-war/pom.xml b/gerrit-war/pom.xml index b4f2ec1387..916783c777 100644 --- a/gerrit-war/pom.xml +++ b/gerrit-war/pom.xml @@ -2,7 +2,7 @@ 4.0.0 com.google.gerrit gerrit-war - 2.14.20 + 2.14.21-SNAPSHOT war Gerrit Code Review - WAR Gerrit WAR diff --git a/version.bzl b/version.bzl index d323cd4069..539438ef11 100644 --- a/version.bzl +++ b/version.bzl @@ -2,4 +2,4 @@ # Used by :api_install and :api_deploy targets # when talking to the destination repository. # -GERRIT_VERSION = "2.14.20" +GERRIT_VERSION = "2.14.21-SNAPSHOT" From 1c04c59e80838a9c3d72bfbabdb5d64cd0ac5c55 Mon Sep 17 00:00:00 2001 From: David Pursehouse Date: Wed, 16 Oct 2019 11:13:32 +0900 Subject: [PATCH 2/8] Replace references to bazel-genfiles with bazel-bin In bazel 0.25 the target directory was changed from bazel-genfiles to bazel-bin and bazel-genfiles was symlinked to bazel-bin. In bazel 1.0 the symlink no longer gets created, and this causes the ./tools/maven/api.sh script to fail on a clean workspace because it still refers to the old location: ./tools/maven/api.sh: line 66: ./bazel-genfiles/tools/maven/api_install.sh: No such file or directory Fix api.sh to use bazel-bin, and also update dev-build-plugin.txt to refer to bazel-bin. Note that some documentation was previously updated in I9521cd7e5. Bug: Issue 11757 Change-Id: I21f204d44ac78559f51ad2e62b085240170d83a7 --- Documentation/dev-build-plugins.txt | 2 +- tools/maven/api.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Documentation/dev-build-plugins.txt b/Documentation/dev-build-plugins.txt index 072c22c9dc..9bf41e2ca8 100644 --- a/Documentation/dev-build-plugins.txt +++ b/Documentation/dev-build-plugins.txt @@ -69,7 +69,7 @@ bazel build plugins/: The output can be normally found in the following directory: ---- -bazel-genfiles/plugins//.jar +bazel-bin/plugins//.jar ---- Some plugins describe their build process in `src/main/resources/Documentation/build.md` diff --git a/tools/maven/api.sh b/tools/maven/api.sh index e72e3cbaee..076ef87d2f 100755 --- a/tools/maven/api.sh +++ b/tools/maven/api.sh @@ -63,4 +63,4 @@ fi bazel build //tools/maven:gen_${command} "$@" || \ { echo "bazel failed to build gen_${command}. Use VERBOSE=1 for more info" ; exit 1 ; } -./bazel-genfiles/tools/maven/${command}.sh +./bazel-bin/tools/maven/${command}.sh From b7879ea14acd41b3d33922101d3042bbefa616e8 Mon Sep 17 00:00:00 2001 From: David Pursehouse Date: Wed, 16 Oct 2019 13:41:37 +0900 Subject: [PATCH 3/8] Remove buck related entries from .gitignore Change-Id: I88469233bc3c89809b2146fd56b73852f8ddb885 --- .gitignore | 2 -- 1 file changed, 2 deletions(-) diff --git a/.gitignore b/.gitignore index d1ddc33445..b1ad00cde3 100644 --- a/.gitignore +++ b/.gitignore @@ -11,7 +11,6 @@ /.apt_generated /.apt_generated_tests /.bazel_path -/.buckd /.classpath /.factorypath /.idea @@ -22,7 +21,6 @@ /.settings/org.maven.ide.eclipse.prefs /bazel-* /bin/ -/buck-out /eclipse-out /extras /gerrit-package-plugins From e17fe936566f1a8766d19a8652efb9e2ea499f77 Mon Sep 17 00:00:00 2001 From: David Pursehouse Date: Tue, 15 Oct 2019 14:06:03 +0900 Subject: [PATCH 4/8] ProjectConfig: Add method to read from repository The class has static methods to read the config using an instance of MetaDataUpdate, but callers don't always necessarily want to do an update, so instantiating an instance of MetaDataUpdate is unnecessary. Add a new method that allows to read by passing the repository. Change-Id: Ic206e4893ab42904a80cfefcf56f8244db384710 --- .../java/com/google/gerrit/server/git/ProjectConfig.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/gerrit-server/src/main/java/com/google/gerrit/server/git/ProjectConfig.java b/gerrit-server/src/main/java/com/google/gerrit/server/git/ProjectConfig.java index ca61f80fd4..3f0b071ecf 100644 --- a/gerrit-server/src/main/java/com/google/gerrit/server/git/ProjectConfig.java +++ b/gerrit-server/src/main/java/com/google/gerrit/server/git/ProjectConfig.java @@ -75,6 +75,7 @@ import org.eclipse.jgit.errors.ConfigInvalidException; import org.eclipse.jgit.lib.CommitBuilder; import org.eclipse.jgit.lib.Config; import org.eclipse.jgit.lib.ObjectId; +import org.eclipse.jgit.lib.Repository; import org.eclipse.jgit.transport.RefSpec; public class ProjectConfig extends VersionedMetaData implements ValidationError.Sink { @@ -208,6 +209,14 @@ public class ProjectConfig extends VersionedMetaData implements ValidationError. return r; } + // TODO(dpursehouse): Add @UsedAt annotation + public static ProjectConfig read(Repository repo, Project.NameKey name) + throws IOException, ConfigInvalidException { + ProjectConfig r = new ProjectConfig(name); + r.load(repo); + return r; + } + public static CommentLinkInfoImpl buildCommentLink(Config cfg, String name, boolean allowRaw) throws IllegalArgumentException { String match = cfg.getString(COMMENTLINK, name, KEY_MATCH); From bb402980086bc0f23e1c33a90bb6e44cdfec1b5e Mon Sep 17 00:00:00 2001 From: Dhruv Srivastava Date: Mon, 7 Oct 2019 14:47:50 +0200 Subject: [PATCH 5/8] Change screen: Show abbreviated commit sha1 in patch set dropdown Add the sha hash of each patchset in dropdown menu as it was in the old UI. Bug: Issue 8513 Change-Id: I9e2f63ff083717ddc096b95e9a0927f5d0446385 --- .../gr-patch-set-behavior.html | 7 +- .../gr-file-list/gr-file-list_test.html | 16 ++--- .../gr-patch-range-select.js | 21 ++++-- .../gr-patch-range-select_test.html | 64 +++++++++---------- 4 files changed, 61 insertions(+), 47 deletions(-) diff --git a/polygerrit-ui/app/behaviors/gr-patch-set-behavior/gr-patch-set-behavior.html b/polygerrit-ui/app/behaviors/gr-patch-set-behavior/gr-patch-set-behavior.html index d4e83d9870..48b575bc52 100644 --- a/polygerrit-ui/app/behaviors/gr-patch-set-behavior/gr-patch-set-behavior.html +++ b/polygerrit-ui/app/behaviors/gr-patch-set-behavior/gr-patch-set-behavior.html @@ -136,6 +136,7 @@ limitations under the License. * * num {number} The number identifying the patch set * * desc {!string} Optional patch set description * * wip {boolean} If true, this patch set was never subject to review. + * * sha {string} hash of the commit * * The wip property is determined by the change's current work_in_progress * property and its log of change messages. @@ -148,14 +149,18 @@ limitations under the License. if (!change) { return []; } let patchNums = []; if (change.revisions && Object.keys(change.revisions).length) { + const revisions = Object.keys(change.revisions).map(sha => { + return Object.assign({sha}, change.revisions[sha]); + }); patchNums = - Gerrit.PatchSetBehavior.sortRevisions(Object.values(change.revisions)) + Gerrit.PatchSetBehavior.sortRevisions(revisions) .map(e => { // TODO(kaspern): Mark which patchset an edit was made on, if an // edit exists -- perhaps with a temporary description. return { num: e._number, desc: e.description, + sha: e.sha, }; }); } diff --git a/polygerrit-ui/app/elements/change/gr-file-list/gr-file-list_test.html b/polygerrit-ui/app/elements/change/gr-file-list/gr-file-list_test.html index da35a4aa8b..fbf2175ea0 100644 --- a/polygerrit-ui/app/elements/change/gr-file-list/gr-file-list_test.html +++ b/polygerrit-ui/app/elements/change/gr-file-list/gr-file-list_test.html @@ -899,17 +899,17 @@ limitations under the License. test('patch set from revisions', () => { const expected = [ - {num: 4, desc: 'test'}, - {num: 3, desc: 'test'}, - {num: 2, desc: 'test'}, - {num: 1, desc: 'test'}, + {num: 4, desc: 'test', sha: 'rev4'}, + {num: 3, desc: 'test', sha: 'rev3'}, + {num: 2, desc: 'test', sha: 'rev2'}, + {num: 1, desc: 'test', sha: 'rev1'}, ]; const patchNums = element.computeAllPatchSets({ revisions: { - rev3: {_number: 3, description: 'test'}, - rev1: {_number: 1, description: 'test'}, - rev4: {_number: 4, description: 'test'}, - rev2: {_number: 2, description: 'test'}, + rev3: {_number: 3, description: 'test', date: 3}, + rev1: {_number: 1, description: 'test', date: 1}, + rev4: {_number: 4, description: 'test', date: 4}, + rev2: {_number: 2, description: 'test', date: 2}, }, }); assert.equal(patchNums.length, expected.length); diff --git a/polygerrit-ui/app/elements/diff/gr-patch-range-select/gr-patch-range-select.js b/polygerrit-ui/app/elements/diff/gr-patch-range-select/gr-patch-range-select.js index cf8118f61b..beacdb4a1d 100644 --- a/polygerrit-ui/app/elements/diff/gr-patch-range-select/gr-patch-range-select.js +++ b/polygerrit-ui/app/elements/diff/gr-patch-range-select/gr-patch-range-select.js @@ -61,6 +61,10 @@ behaviors: [Gerrit.PatchSetBehavior], + _getShaForPatch(patch) { + return patch.sha.substring(0, 10); + }, + _computeBaseDropdownContent(availablePatches, patchNum, _sortedRevisions, changeComments, revisionInfo) { const parentCounts = revisionInfo.getParentCountMap(); @@ -73,7 +77,7 @@ for (const basePatch of availablePatches) { const basePatchNum = basePatch.num; const entry = this._createDropdownEntry(basePatchNum, 'Patchset ', - _sortedRevisions, changeComments); + _sortedRevisions, changeComments, this._getShaForPatch(basePatch)); dropdownContent.push(Object.assign({}, entry, { disabled: this._computeLeftDisabled( basePatch.num, patchNum, _sortedRevisions), @@ -111,7 +115,7 @@ const patchNum = patch.num; const entry = this._createDropdownEntry( patchNum, patchNum === 'edit' ? '' : 'Patchset ', _sortedRevisions, - changeComments); + changeComments, this._getShaForPatch(patch)); dropdownContent.push(Object.assign({}, entry, { disabled: this._computeRightDisabled(basePatchNum, patchNum, _sortedRevisions), @@ -120,12 +124,17 @@ return dropdownContent; }, - _createDropdownEntry(patchNum, prefix, sortedRevisions, changeComments) { + _computeText(patchNum, prefix, changeComments, sha) { + return `${prefix}${patchNum}` + + `${this._computePatchSetCommentsString(changeComments, patchNum)}` + + (` | ${sha}`); + }, + + _createDropdownEntry(patchNum, prefix, sortedRevisions, changeComments, + sha) { const entry = { triggerText: `${prefix}${patchNum}`, - text: `${prefix}${patchNum}` + - `${this._computePatchSetCommentsString( - changeComments, patchNum)}`, + text: this._computeText(patchNum, prefix, changeComments, sha), mobileText: this._computeMobileText(patchNum, changeComments, sortedRevisions), bottomText: `${this._computePatchSetDescription( diff --git a/polygerrit-ui/app/elements/diff/gr-patch-range-select/gr-patch-range-select_test.html b/polygerrit-ui/app/elements/diff/gr-patch-range-select/gr-patch-range-select_test.html index 99d22c6c68..f6394e742e 100644 --- a/polygerrit-ui/app/elements/diff/gr-patch-range-select/gr-patch-range-select_test.html +++ b/polygerrit-ui/app/elements/diff/gr-patch-range-select/gr-patch-range-select_test.html @@ -118,10 +118,10 @@ limitations under the License. test('_computeBaseDropdownContent', () => { const availablePatches = [ - {num: 'edit'}, - {num: 3}, - {num: 2}, - {num: 1}, + {num: 'edit', sha: '1'}, + {num: 3, sha: '2'}, + {num: 2, sha: '3'}, + {num: 1, sha: '4'}, ]; const revisions = [ { @@ -145,7 +145,7 @@ limitations under the License. { disabled: true, triggerText: 'Patchset edit', - text: 'Patchset edit', + text: 'Patchset edit | 1', mobileText: 'edit', bottomText: '', value: 'edit', @@ -153,7 +153,7 @@ limitations under the License. { disabled: true, triggerText: 'Patchset 3', - text: 'Patchset 3', + text: 'Patchset 3 | 2', mobileText: '3', bottomText: '', value: 3, @@ -162,7 +162,7 @@ limitations under the License. { disabled: true, triggerText: 'Patchset 2', - text: 'Patchset 2', + text: 'Patchset 2 | 3', mobileText: '2 description', bottomText: 'description', value: 2, @@ -170,7 +170,7 @@ limitations under the License. { disabled: true, triggerText: 'Patchset 1', - text: 'Patchset 1', + text: 'Patchset 1 | 4', mobileText: '1', bottomText: '', value: 1, @@ -195,10 +195,10 @@ limitations under the License. ]; element.revisionInfo = getInfo(element.revisions); element.availablePatches = [ - {num: 1}, - {num: 2}, - {num: 3}, - {num: 'edit'}, + {num: 1, sha: '1'}, + {num: 2, sha: '2'}, + {num: 3, sha: '3'}, + {num: 'edit', sha: '4'}, ]; element.patchNum = 2; element.basePatchNum = 'PARENT'; @@ -221,10 +221,10 @@ limitations under the License. ]; element.revisionInfo = getInfo(element.revisions); element.availablePatches = [ - {num: 'edit'}, - {num: 3}, - {num: 2}, - {num: 1}, + {num: 'edit', sha: '1'}, + {num: 3, sha: '2'}, + {num: 2, sha: '3'}, + {num: 1, sha: '4'}, ]; element.patchNum = 2; element.basePatchNum = 'PARENT'; @@ -248,10 +248,10 @@ limitations under the License. ]; element.revisionInfo = getInfo(element.revisions); element.availablePatches = [ - {num: 1}, - {num: 2}, - {num: 3}, - {num: 'edit'}, + {num: 1, sha: '1'}, + {num: 2, sha: '2'}, + {num: 3, sha: '3'}, + {num: 'edit', sha: '4'}, ]; element.patchNum = 2; element.basePatchNum = 'PARENT'; @@ -272,10 +272,10 @@ limitations under the License. ]; element.revisionInfo = getInfo(element.revisions); element.availablePatches = [ - {num: 1}, - {num: 2}, - {num: 3}, - {num: 'edit'}, + {num: 1, sha: '1'}, + {num: 2, sha: '2'}, + {num: 3, sha: '3'}, + {num: 'edit', sha: '4'}, ]; element.patchNum = 2; element.basePatchNum = 'PARENT'; @@ -291,10 +291,10 @@ limitations under the License. test('_computePatchDropdownContent', () => { const availablePatches = [ - {num: 'edit'}, - {num: 3}, - {num: 2}, - {num: 1}, + {num: 'edit', sha: '1'}, + {num: 3, sha: '2'}, + {num: 2, sha: '3'}, + {num: 1, sha: '4'}, ]; const basePatchNum = 1; const sortedRevisions = [ @@ -308,7 +308,7 @@ limitations under the License. { disabled: false, triggerText: 'edit', - text: 'edit', + text: 'edit | 1', mobileText: 'edit', bottomText: '', value: 'edit', @@ -316,7 +316,7 @@ limitations under the License. { disabled: false, triggerText: 'Patchset 3', - text: 'Patchset 3', + text: 'Patchset 3 | 2', mobileText: '3', bottomText: '', value: 3, @@ -325,7 +325,7 @@ limitations under the License. { disabled: false, triggerText: 'Patchset 2', - text: 'Patchset 2', + text: 'Patchset 2 | 3', mobileText: '2 description', bottomText: 'description', value: 2, @@ -333,7 +333,7 @@ limitations under the License. { disabled: true, triggerText: 'Patchset 1', - text: 'Patchset 1', + text: 'Patchset 1 | 4', mobileText: '1', bottomText: '', value: 1, From 001246b02abec8783092a58fcec85b0892205c00 Mon Sep 17 00:00:00 2001 From: Luca Milanesio Date: Wed, 16 Oct 2019 13:45:13 +0100 Subject: [PATCH 6/8] Use bazelisk as first choice for api.sh api.sh should prefer bazelisk as first choice for running bazel, falling back to the current bazel binary. Change-Id: I047112b81ad90d2f6c00c6592ba856f2a7108b43 --- tools/maven/api.sh | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/tools/maven/api.sh b/tools/maven/api.sh index 076ef87d2f..c6049bf3db 100755 --- a/tools/maven/api.sh +++ b/tools/maven/api.sh @@ -60,7 +60,13 @@ if [[ "${VERBOSE:-x}" != "x" ]]; then set -o xtrace fi -bazel build //tools/maven:gen_${command} "$@" || \ - { echo "bazel failed to build gen_${command}. Use VERBOSE=1 for more info" ; exit 1 ; } +if [[ `which bazelisk` ]]; then + BAZEL_CMD=bazelisk +else + BAZEL_CMD=bazel +fi + +${BAZEL_CMD} build //tools/maven:gen_${command} "$@" || \ + { echo "${BAZEL_CMD} failed to build gen_${command}. Use VERBOSE=1 for more info" ; exit 1 ; } ./bazel-bin/tools/maven/${command}.sh From 658978f2c9c18e01b880c72206f901cab33f1be7 Mon Sep 17 00:00:00 2001 From: David Pursehouse Date: Thu, 17 Oct 2019 00:34:25 +0900 Subject: [PATCH 7/8] ProjectConfig: Add @UsedAt annotation Change-Id: Ib65d3265cb4542ab88761d308d607c9eee6573ed --- java/com/google/gerrit/server/project/ProjectConfig.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/java/com/google/gerrit/server/project/ProjectConfig.java b/java/com/google/gerrit/server/project/ProjectConfig.java index 1aac2939fd..9ac1e54363 100644 --- a/java/com/google/gerrit/server/project/ProjectConfig.java +++ b/java/com/google/gerrit/server/project/ProjectConfig.java @@ -50,6 +50,7 @@ import com.google.gerrit.reviewdb.client.BooleanProjectConfig; import com.google.gerrit.reviewdb.client.Branch; import com.google.gerrit.reviewdb.client.Project; import com.google.gerrit.reviewdb.client.RefNames; +import com.google.gerrit.server.UsedAt; import com.google.gerrit.server.account.GroupBackend; import com.google.gerrit.server.account.ProjectWatches.NotifyType; import com.google.gerrit.server.config.ConfigUtil; @@ -200,7 +201,7 @@ public class ProjectConfig extends VersionedMetaData implements ValidationError. return r; } - // TODO(dpursehouse): Add @UsedAt annotation + @UsedAt(UsedAt.Project.COLLABNET) public static ProjectConfig read(Repository repo, Project.NameKey name) throws IOException, ConfigInvalidException { ProjectConfig r = new ProjectConfig(name); From 27ca7c61e9251424c740d626152ec36f4fcfb211 Mon Sep 17 00:00:00 2001 From: David Pursehouse Date: Thu, 17 Oct 2019 00:34:59 +0900 Subject: [PATCH 8/8] CreateProject: Add @UsedAt annotation Change-Id: I541843900f2dd3ca8908369f871be3ac243f544a --- .../google/gerrit/server/restapi/project/CreateProject.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/java/com/google/gerrit/server/restapi/project/CreateProject.java b/java/com/google/gerrit/server/restapi/project/CreateProject.java index 4c02bd2434..74b185d7f9 100644 --- a/java/com/google/gerrit/server/restapi/project/CreateProject.java +++ b/java/com/google/gerrit/server/restapi/project/CreateProject.java @@ -47,6 +47,7 @@ import com.google.gerrit.reviewdb.client.Project; import com.google.gerrit.reviewdb.client.RefNames; import com.google.gerrit.server.GerritPersonIdent; import com.google.gerrit.server.IdentifiedUser; +import com.google.gerrit.server.UsedAt; import com.google.gerrit.server.account.GroupBackend; import com.google.gerrit.server.config.AllProjectsName; import com.google.gerrit.server.config.AllUsersName; @@ -240,7 +241,7 @@ public class CreateProject } } - // TODO(dpursehouse): Add @UsedAt annotation + @UsedAt(UsedAt.Project.COLLABNET) public ProjectState createProject(CreateProjectArgs args) throws BadRequestException, ResourceConflictException, IOException, ConfigInvalidException { final Project.NameKey nameKey = args.getProject();