Change: Add helper methods to check change state
To check a change's state the caller currently has to call getState() and then do a comparison on the enum value. To make this easier, introduce new methods on Change: - isNew - isMerged - isAbandoned - isClosed Note that we don't add "isOpen" since there are no longer multiple states that could be considered "open". Previously there were "new" and "draft", but the draft workflow was removed. Update callers to use the new methods. Change-Id: Ic047f74b114e2277e66c878dace73ea8e0babab6
This commit is contained in:
@@ -19,7 +19,6 @@ import static com.google.common.base.Preconditions.checkState;
|
||||
import com.google.gerrit.extensions.restapi.MergeConflictException;
|
||||
import com.google.gerrit.extensions.restapi.ResourceConflictException;
|
||||
import com.google.gerrit.extensions.restapi.RestApiException;
|
||||
import com.google.gerrit.reviewdb.client.Change;
|
||||
import com.google.gerrit.reviewdb.client.PatchSet;
|
||||
import com.google.gerrit.reviewdb.client.RevId;
|
||||
import com.google.gerrit.server.ChangeUtil;
|
||||
@@ -194,8 +193,8 @@ public class RebaseChangeOp implements BatchUpdateOp {
|
||||
+ " was rebased");
|
||||
}
|
||||
|
||||
if (base != null && base.notes().getChange().getStatus() != Change.Status.MERGED) {
|
||||
if (base.notes().getChange().getStatus() != Change.Status.MERGED) {
|
||||
if (base != null && !base.notes().getChange().isMerged()) {
|
||||
if (!base.notes().getChange().isMerged()) {
|
||||
// Add to end of relation chain for open base change.
|
||||
patchSetInserter.setGroups(base.patchSet().getGroups());
|
||||
} else {
|
||||
|
Reference in New Issue
Block a user