diff options
author | Jukka Jokiniva <jukka.jokiniva@qt.io> | 2018-10-03 09:22:08 +0300 |
---|---|---|
committer | Jukka Jokiniva <jukka.jokiniva@qt.io> | 2018-12-18 11:28:04 +0000 |
commit | 64797f33b13f4cc17eb1f4e741f216bed82c1526 (patch) | |
tree | 193a0cd0bdb6f8e8c67c1c1f54fc7d1d2fbc80b8 | |
parent | 14c23c2515f6e30dcbe4f91cbc421af1747b05b0 (diff) |
Add new status values: staged, integrating and deferred
Change-Id: I38c18e98219b9e28863f57e6e70887f25d6c9dfa
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
5 files changed, 63 insertions, 3 deletions
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/reviewdb/client/Change.java b/java/com/google/gerrit/reviewdb/client/Change.java index 8d4de0526f..c32b342901 100644 --- a/java/com/google/gerrit/reviewdb/client/Change.java +++ b/java/com/google/gerrit/reviewdb/client/Change.java @@ -305,9 +305,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'; @@ -341,6 +348,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. * @@ -355,7 +365,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/server/query/change/InternalChangeQuery.java b/java/com/google/gerrit/server/query/change/InternalChangeQuery.java index 495d27c800..877e97ce95 100644 --- a/java/com/google/gerrit/server/query/change/InternalChangeQuery.java +++ b/java/com/google/gerrit/server/query/change/InternalChangeQuery.java @@ -167,6 +167,10 @@ public class InternalChangeQuery extends InternalQuery<ChangeData> { return query(and(ref(branch), project(branch.getParentKey()), status(Change.Status.NEW))); } + public List<ChangeData> byBranchStatus(Branch.NameKey branch, Change.Status status) throws OrmException { + return query(and(ref(branch), project(branch.getParentKey()), status(status))); + } + public Iterable<ChangeData> byCommitsOnBranchNotMerged( Repository repo, ReviewDb db, Branch.NameKey branch, Collection<String> hashes) throws OrmException, IOException { 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 2cb00f4a54..8ca8d24e0a 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. @@ -139,6 +142,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 909a1ee0ec..d07eae4db6 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 @@ -1353,7 +1353,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(); } |