From 5d44ddce9f8ea77d9a66cc848197e02bdf91e999 Mon Sep 17 00:00:00 2001 From: Dave Borowitz Date: Fri, 27 Jun 2014 13:47:20 -0700 Subject: [PATCH] Allow forcing mergeability check through the REST API. Due to bugs like I8aeb0c87, some changes might end up with incorrect values of the mergeable flag. They should normally correct themselves as the branch advances, but provide an option to the /mergeable endpoint for the impatient. Change-Id: I961f9dccf67373946b153bb99f4fdac73f38cac4 --- Documentation/rest-api-changes.txt | 3 +++ .../com/google/gerrit/server/change/Mergeable.java | 10 ++++++---- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/Documentation/rest-api-changes.txt b/Documentation/rest-api-changes.txt index 5d6c32268d..fb408836e5 100644 --- a/Documentation/rest-api-changes.txt +++ b/Documentation/rest-api-changes.txt @@ -1852,6 +1852,9 @@ As response a link:#mergeable-info[MergeableInfo] entity is returned. If the `other-branches` parameter is specified, the mergeability will also be checked for all other branches. +If the `force` parameter is specified, the mergeability against the destination +will be rechecked, in case of prior transient failures or bugs. + .Request ---- GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/current/mergeable?other-branches HTTP/1.0 diff --git a/gerrit-server/src/main/java/com/google/gerrit/server/change/Mergeable.java b/gerrit-server/src/main/java/com/google/gerrit/server/change/Mergeable.java index f2c4adc61e..c17afb8e4e 100644 --- a/gerrit-server/src/main/java/com/google/gerrit/server/change/Mergeable.java +++ b/gerrit-server/src/main/java/com/google/gerrit/server/change/Mergeable.java @@ -73,6 +73,12 @@ public class Mergeable implements RestReadView { usage = "test mergeability for other branches too") private boolean otherBranches; + @Option(name = "--force", aliases = {"-f"}, + usage = "force recheck of mergeable field") + public void setForce(boolean force) { + this.force = force; + } + private final TestSubmitType.Get submitType; private final GitRepositoryManager gitManager; private final ProjectCache projectCache; @@ -97,10 +103,6 @@ public class Mergeable implements RestReadView { this.indexer = indexer; } - public void setForce(boolean force) { - this.force = force; - } - @Override public MergeableInfo apply(RevisionResource resource) throws AuthException, ResourceConflictException, BadRequestException, OrmException, IOException {