Merge branch 'stable-2.12' into stable-2.13

* stable-2.12:
  Reindex the change after forcing patchset as draft

Change-Id: I94bd63c01056beb056f5ff8885071936b7619d24
diff --git a/lib/gerrit/BUCK b/lib/gerrit/BUCK
index 4055450..3a25946 100644
--- a/lib/gerrit/BUCK
+++ b/lib/gerrit/BUCK
@@ -1,12 +1,12 @@
 include_defs('//bucklets/maven_jar.bucklet')
 
-VER = '2.12'
+VER = '2.13'
 REPO = MAVEN_CENTRAL
 
 maven_jar(
   name = 'plugin-api',
   id = 'com.google.gerrit:gerrit-plugin-api:' + VER,
-  sha1 = '8ce1f6e65078bbcf03a1758f96b3ebca19b7fe3c',
+  sha1 = 'e25d55b8f41627c4ae6b9d2069ec398638b219a3',
   license = 'Apache2.0',
   attach_source = False,
   repository = REPO,
diff --git a/src/main/java/com/googlesource/gerrit/plugins/forcedraft/ForceDraft.java b/src/main/java/com/googlesource/gerrit/plugins/forcedraft/ForceDraft.java
index f0407db..1554c58 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/forcedraft/ForceDraft.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/forcedraft/ForceDraft.java
@@ -22,7 +22,7 @@
 import com.google.gerrit.reviewdb.client.PatchSet;
 import com.google.gerrit.reviewdb.server.ReviewDb;
 import com.google.gerrit.server.config.GerritServerConfig;
-import com.google.gerrit.server.index.ChangeIndexer;
+import com.google.gerrit.server.index.change.ChangeIndexer;
 import com.google.gerrit.sshd.CommandMetaData;
 import com.google.gerrit.sshd.SshCommand;
 import com.google.gerrit.common.data.GlobalCapability;
@@ -224,15 +224,12 @@
    */
   private void updatePatchSet() throws OrmException, IOException {
     Change.Status changeStatus = parentChange.getStatus();
-    switch (changeStatus) {
-      case NEW:
-        setPatchSetAsDraft();
-        changeIndexer.index(dbProvider.get(), updateChange());
-        break;
-      default:
-        sendUserInfo("Unable to set patch set as draft, change is "
-            + getStatusName(changeStatus));
-        break;
+    if (changeStatus == Change.Status.NEW) {
+      setPatchSetAsDraft();
+      changeIndexer.index(dbProvider.get(), updateChange());
+    } else {
+      sendUserInfo("Unable to set patch set as draft, change is "
+          + getStatusName(changeStatus));
     }
   }