Add action to close bugs and set resolution in a single request

Change-Id: Ief8880bdcda20d40c48f4a13e8bee720bb5e68d0
diff --git a/src/main/java/com/googlesource/gerrit/plugins/hooks/bz/BugzillaClient.java b/src/main/java/com/googlesource/gerrit/plugins/hooks/bz/BugzillaClient.java
index 6b6609a..715c7b6 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/hooks/bz/BugzillaClient.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/hooks/bz/BugzillaClient.java
@@ -93,12 +93,30 @@
     }
   }
 
+  private void performChainedAction(final Bug bug, final String actionName,
+      final String actionValue) throws BugzillaException,
+      InvalidTransitionException {
+    String[] actionNames = actionName.split("/");
+    String[] actionValues = actionValue.split("/");
+    if (actionNames.length != actionValues.length) {
+      throw new InvalidTransitionException("Number of chained actions does not"
+        + " match number of action values");
+    }
+
+    int i;
+    for (i=0; i<actionNames.length; i++) {
+        performSimpleActionChainable(bug, actionNames[i], actionValues[i]);
+    }
+  }
+
   public void performAction(final String bugId, final String actionName,
       final String actionValue) throws BugzillaException,
       InvalidTransitionException {
     Bug bug = getBug(bugId);
     if ("status".equals(actionName) || "resolution".equals(actionName)) {
       performSimpleActionChainable(bug, actionName, actionValue);
+    } else if ("status/resolution".equals(actionName)) {
+      performChainedAction(bug, actionName, actionValue);
     } else {
       throw new InvalidTransitionException("Action " + actionName + " is not"
         + " known");
diff --git a/src/main/resources/Documentation/config.md b/src/main/resources/Documentation/config.md
index 81c84ac..bac2ba0 100644
--- a/src/main/resources/Documentation/config.md
+++ b/src/main/resources/Documentation/config.md
@@ -128,6 +128,11 @@
 	    RESOLUTION can be any of the values your bugzilla configuration
 	    allows as resolution. Setting the resolution has only an effect if
 	    the associated bug is in a closed state.
+	  status/resolution STATUS/RESOLUTION
+	    change the associated bug's status to STATUS and resolution to
+	    RESOLUTION, where STATUS can be any of the values your bugzilla
+	    configuration allows to close bugs, and RESOLUTION can be any of the
+	    values your bugzilla configuration allows as resolution.
 
 `<change-action>`
 :	Action performed on Gerrit change-id, possible values are: