From 6ff48695ecf7681aef4fedfbb894d3d63b5e222c Mon Sep 17 00:00:00 2001 From: Aaron Gable Date: Fri, 4 May 2018 10:17:06 -0700 Subject: [PATCH] Add PG UI support for new changes with base commit This allows users to specify a non-HEAD base commit when creating a new change from the web UI. Bug: Issue 8857 Change-Id: Ic585fafacc4bf21cd1d8bd129e889b42180b80a7 --- .../gr-create-change-dialog.html | 11 +++++++++++ .../gr-create-change-dialog.js | 4 +++- .../gr-rest-api-interface/gr-rest-api-interface.js | 4 +++- 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/polygerrit-ui/app/elements/admin/gr-create-change-dialog/gr-create-change-dialog.html b/polygerrit-ui/app/elements/admin/gr-create-change-dialog/gr-create-change-dialog.html index a652e26d6e..85f01e79a3 100644 --- a/polygerrit-ui/app/elements/admin/gr-create-change-dialog/gr-create-change-dialog.html +++ b/polygerrit-ui/app/elements/admin/gr-create-change-dialog/gr-create-change-dialog.html @@ -72,6 +72,17 @@ limitations under the License. +
+ Provide base commit sha1 for change + + + +
Enter topic for new change diff --git a/polygerrit-ui/app/elements/admin/gr-create-change-dialog/gr-create-change-dialog.js b/polygerrit-ui/app/elements/admin/gr-create-change-dialog/gr-create-change-dialog.js index 8252d88e40..b7388290a2 100644 --- a/polygerrit-ui/app/elements/admin/gr-create-change-dialog/gr-create-change-dialog.js +++ b/polygerrit-ui/app/elements/admin/gr-create-change-dialog/gr-create-change-dialog.js @@ -37,6 +37,7 @@ }, }, baseChange: String, + baseCommit: String, privateByDefault: String, canCreate: { type: Boolean, @@ -73,7 +74,8 @@ const isPrivate = this.$.privateChangeCheckBox.checked; const isWip = true; return this.$.restAPI.createChange(this.repoName, this.branch, - this.subject, this.topic, isPrivate, isWip, this.baseChange) + this.subject, this.topic, isPrivate, isWip, this.baseChange, + this.baseCommit) .then(changeCreated => { if (!changeCreated) { return; } Gerrit.Nav.navigateToChange(changeCreated); 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 a9fd05cb4d..86b0996099 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 @@ -1410,9 +1410,10 @@ * @param {boolean=} opt_isPrivate * @param {boolean=} opt_workInProgress * @param {string=} opt_baseChange + * @param {string=} opt_baseCommit */ createChange(project, branch, subject, opt_topic, opt_isPrivate, - opt_workInProgress, opt_baseChange) { + opt_workInProgress, opt_baseChange, opt_baseCommit) { return this.send('POST', '/changes/', { project, branch, @@ -1421,6 +1422,7 @@ is_private: opt_isPrivate, work_in_progress: opt_workInProgress, base_change: opt_baseChange, + base_commit: opt_baseCommit, }).then(response => this.getResponseObject(response)); },