diff options
author | Jukka Jokiniva <jukka.jokiniva@qt.io> | 2018-10-03 09:22:08 +0300 |
---|---|---|
committer | Alexandru Croitor <alexandru.croitor@qt.io> | 2020-09-22 11:32:04 +0000 |
commit | 2f21106bb2de1c6bdc040cc13e7eb4dd13b5d9e8 (patch) | |
tree | e73ac4defcf5753cf2fcb494bdaef8b4dcc7d455 | |
parent | f99ede50a4bc08729a7a7d1dabf3f59cbf936644 (diff) |
Add new status values: staged, integrating and deferred
Change-Id: I38c18e98219b9e28863f57e6e70887f25d6c9dfa
(cherry picked from commit 2020fc379ebbb578ca42b8f79001932e3a257af3)
Reviewed-by: Jukka Jokiniva <jukka.jokiniva@qt.io>
5 files changed, 63 insertions, 3 deletions
diff --git a/java/com/google/gerrit/entities/Change.java b/java/com/google/gerrit/entities/Change.java index 739bd38097..954c9ff5ac 100644 --- a/java/com/google/gerrit/entities/Change.java +++ b/java/com/google/gerrit/entities/Change.java @@ -324,9 +324,16 @@ public final class Change { private static final char MIN_OPEN = 'a'; /** Database constant for {@link Status#NEW}. */ public static final char STATUS_NEW = 'n'; + /** Maximum database status constant for an open change. */ private static final char MAX_OPEN = 'z'; + /** Database constant for {@link Status#STAGED}. */ + public static final char STATUS_STAGED = 'R'; + + /** Database constant for {@link Status#INTEGRATING}. */ + public static final char STATUS_INTEGRATING = 'I'; + /** Database constant for {@link Status#MERGED}. */ public static final char STATUS_MERGED = 'M'; @@ -360,6 +367,9 @@ public final class Change { */ NEW(STATUS_NEW, ChangeStatus.NEW), + STAGED(STATUS_STAGED, ChangeStatus.STAGED), + INTEGRATING(STATUS_INTEGRATING, ChangeStatus.INTEGRATING), + /** * Change is closed, and submitted to its destination branch. * @@ -374,7 +384,9 @@ public final class Change { * patch set, and it cannot be merged. Draft comments however may be published, permitting * reviewers to send constructive feedback. */ - ABANDONED('A', ChangeStatus.ABANDONED); + ABANDONED('A', ChangeStatus.ABANDONED), + + DEFERRED('D', ChangeStatus.DEFERRED); static { boolean ok = true; diff --git a/java/com/google/gerrit/extensions/client/ChangeStatus.java b/java/com/google/gerrit/extensions/client/ChangeStatus.java index 83d5bd2cc7..89cdf5d468 100644 --- a/java/com/google/gerrit/extensions/client/ChangeStatus.java +++ b/java/com/google/gerrit/extensions/client/ChangeStatus.java @@ -34,6 +34,22 @@ public enum ChangeStatus { NEW, /** + * Change is staged and waiting for CI to start a build of it. + * + * <p> While a change is staged, it cannot be further modified by adding a replacement patch + * set. + */ + STAGED, + + /** + * Change is integrating in a build on a CI system. + * + * <p> While a change is integrating, it cannot be further modified by adding a replacement patch + * set. + */ + INTEGRATING, + + /** * Change is closed, and submitted to its destination branch. * * <p>Once a change has been merged, it cannot be further modified by adding a replacement patch @@ -54,5 +70,21 @@ public enum ChangeStatus { * <li>{@link #NEW} - when the Restore action is used. * </ul> */ - ABANDONED + ABANDONED, + + /** + * Change is closed, but was not submitted to its destination branch. Deferred is similar + * to abandoned, the difference is that the change is expected to be reopened later. + * + * <p>Once a change has been deferred, it cannot be further modified by adding a replacement + * patch set, and it cannot be merged. Draft comments however may be published, permitting + * reviewers to send constructive feedback. + * + * <p>Changes in the DEFERRED state can be moved to: + * + * <ul> + * <li>{@link #NEW} - when the Reopen action is used. + * </ul> + */ + DEFERRED } diff --git a/java/com/google/gerrit/server/query/change/InternalChangeQuery.java b/java/com/google/gerrit/server/query/change/InternalChangeQuery.java index 6605c23da2..720896b0d4 100644 --- a/java/com/google/gerrit/server/query/change/InternalChangeQuery.java +++ b/java/com/google/gerrit/server/query/change/InternalChangeQuery.java @@ -152,6 +152,10 @@ public class InternalChangeQuery extends InternalQuery<ChangeData, InternalChang return query(and(ref(branch), project(branch.project()), status(Change.Status.NEW))); } + public List<ChangeData> byBranchStatus(BranchNameKey branch, Change.Status status) throws OrmException { + return query(and(ref(branch), project(branch.project()), status(status))); + } + public Iterable<ChangeData> byCommitsOnBranchNotMerged( Repository repo, BranchNameKey branch, Collection<String> hashes) throws IOException { return byCommitsOnBranchNotMerged( diff --git a/polygerrit-ui/app/behaviors/rest-client-behavior/rest-client-behavior.html b/polygerrit-ui/app/behaviors/rest-client-behavior/rest-client-behavior.html index 85bc6a194d..5d08eda65f 100644 --- a/polygerrit-ui/app/behaviors/rest-client-behavior/rest-client-behavior.html +++ b/polygerrit-ui/app/behaviors/rest-client-behavior/rest-client-behavior.html @@ -35,8 +35,11 @@ limitations under the License. ChangeStatus: { ABANDONED: 'ABANDONED', + DEFERRED: 'DEFERRED', + INTEGRATING: 'INTEGRATING', MERGED: 'MERGED', NEW: 'NEW', + STAGED: 'STAGED', }, // Must be kept in sync with the ListChangesOption enum and protobuf. @@ -145,6 +148,12 @@ limitations under the License. states.push('Merged'); } else if (change.status === this.ChangeStatus.ABANDONED) { states.push('Abandoned'); + } else if (change.status === this.ChangeStatus.DEFERRED) { + states.push('Deferred'); + } else if (change.status === this.ChangeStatus.INTEGRATING) { + states.push('Integrating'); + } else if (change.status === this.ChangeStatus.STAGED) { + states.push('Staged'); } else if (change.mergeable === false || (opt_options && opt_options.mergeable === false)) { // 'mergeable' prop may not always exist (@see Issue 6819) diff --git a/polygerrit-ui/app/elements/change/gr-change-view/gr-change-view.js b/polygerrit-ui/app/elements/change/gr-change-view/gr-change-view.js index 02cf861afa..4532a04a5d 100644 --- a/polygerrit-ui/app/elements/change/gr-change-view/gr-change-view.js +++ b/polygerrit-ui/app/elements/change/gr-change-view/gr-change-view.js @@ -1532,7 +1532,10 @@ // changes are obviously not mergeable, but the mergeability API will not // answer for abandoned changes. if (this._change.status === this.ChangeStatus.MERGED || - this._change.status === this.ChangeStatus.ABANDONED) { + this._change.status === this.ChangeStatus.STAGED || + this._change.status === this.ChangeStatus.INTEGRATING || + this._change.status === this.ChangeStatus.ABANDONED || + this._change.status === this.ChangeStatus.DEFERRED) { this._mergeable = false; return Promise.resolve(); } |