Merge "Disable PreCQ"
diff --git a/exonerator/gerrit_cq.py b/exonerator/gerrit_cq.py
index d0415e7..3f97b90 100644
--- a/exonerator/gerrit_cq.py
+++ b/exonerator/gerrit_cq.py
@@ -23,7 +23,7 @@
 _FAILED_TO_APPLY_SNIPPET = 'failed to apply your change'
 _VERIFIED_LABEL = 'Verified'
 _EXONERATOR_CQ_MESSAGE = """\
-This CL has been marked innocent in the CL annotator; re-marking as CQ+1.\
+This CL has been marked innocent in the CL annotator; re-marking as CQ+2.\
   See the annotator entry here:
 https://chromiumos-build-annotator.googleplex.com/build_annotations/\
 edit_annotations/master-paladin/%s"""
@@ -32,7 +32,7 @@
 
 
 def MaybeExonerate(change, build_id):
-  """Mark a CL as CQ+1 only if it hasn't already been.
+  """Mark a CL as CQ+2 only if it hasn't already been.
 
   Args:
     change: A GerritPatchTuple.
@@ -52,12 +52,12 @@
     helper.SetReview(
         change.gerrit_number,
         msg=_EXONERATOR_CQ_MESSAGE % build_id,
-        labels={COMMIT_QUEUE_LABEL: 1})
+        labels={COMMIT_QUEUE_LABEL: 2})
     logging.info('Exonerated %s for a CQ failure.', str(change))
     return True
   # Network errors or permission errors won't get retried. That's ok for now.
   except Exception:
-    logging.exception('Encountered an exception while marking %s with CQ+1',
+    logging.exception('Encountered an exception while marking %s with CQ+2',
                       str(change))
     return False
 
@@ -101,7 +101,7 @@
 def _ShouldBeMarkedCQReady(change_details, known_patch_number):
   """Whether a CL should be re-marked as CQ ready.
 
-  We only want to re-label CLs as CQ+1 if they haven't been marked as CQ+1 or
+  We only want to re-label CLs as CQ+2 if they haven't been marked as CQ+2 or
   CQ-1 by someone else, and it's still on the same patchset that was kicked
   out.
 
@@ -111,7 +111,7 @@
   """
   return (
       SanityCheckChange(change_details, known_patch_number)
-      # It shouldn't already have CQ+1 or CQ-1
+      # It shouldn't already have CQ+1/2 or CQ-1
       and not (LabelValues(change_details, COMMIT_QUEUE_LABEL) - {0})
       # The CL must have Verified+1 still.
       and any(label > 0
@@ -129,7 +129,7 @@
 
 
 def CQApprovalWasRemovedByBot(change_details):
-  """Returns whether the CQ+1 label was removed by a bot.
+  """Returns whether the CQ+2 label was removed by a bot.
 
   Args:
     change_details: The response from gerrit with the change's details.
diff --git a/exonerator/gerrit_precq.py b/exonerator/gerrit_precq.py
index 0600afc..1d25ab0 100644
--- a/exonerator/gerrit_precq.py
+++ b/exonerator/gerrit_precq.py
@@ -15,7 +15,6 @@
 
 
 _MESSAGE_FOR_PRECQ_PICKED_UP = 'The Pre-Commit Queue has picked up your change.'
-_TRYBOT_READY_LABEL = 'Trybot-Ready'
 _COMMIT_QUEUE_LABEL = 'Commit-Queue'
 _VERIFIED_LABEL = 'Verified'
 _EXONERATOR_PRECQ_MESSAGE = """\
@@ -104,11 +103,9 @@
       and not any(
           label < 0
           for label in gerrit_cq.LabelValues(change_details, _VERIFIED_LABEL))
-      # It shouldn't already have Trybot-Ready+1, CQ+1 or CQ-1
+      # It shouldn't already have CQ+1/2 or CQ-1
       and not (gerrit_cq.LabelValues(
           change_details, gerrit_cq.COMMIT_QUEUE_LABEL) - {0})
-      and not (gerrit_cq.LabelValues(
-          change_details, _TRYBOT_READY_LABEL) - {0})
       # Don't exonerate CLs with Code-Review-1 or Code-Review-2
       and all(label >= 0
               for label in gerrit_cq.LabelValues(
@@ -119,27 +116,21 @@
 def _LabelToReapply(change_details):
   """Returns the label removed, if the Pre-CQ approval was removed by a bot.
 
-  Either Trybot-Ready+1 or Commit-Queue+1 labels can kick off pre-cq. To
-  exonerate a change, we want to re-apply the labels which gave Pre-CQ approval,
-  but only if they weren't removed by a human. If a human removes approval, it's
-  probably because the change is unsafe or at fault in some way.
+  Commit-Queue+1 or +2 labels can kick off pre-cq. To exonerate a change, we
+  want to re-apply the labels which gave Pre-CQ approval, but only if they
+  weren't removed by a human. If a human removes approval, it's probably because
+  the change is unsafe or at fault in some way.
 
   Args:
     change_details: The response from gerrit with the change's details.
   """
   # Find the latest pre-cq failure message, then walk forward through the
-  # messages to find the next bot laebl removal, if it exists.
+  # messages to find the next bot label removal, if it exists.
   messages = change_details['messages']
   failure_index = _FindLatestPreCQKickoff(messages)
   if failure_index is None:
     return None
-  labels_removed_by_bot = _FindLabelsToReapply(messages[failure_index+1:])
-
-  # Commit-Queue is a superset of Trybot-Ready, so just forgive by applying it.
-  if _COMMIT_QUEUE_LABEL in labels_removed_by_bot:
-    return _COMMIT_QUEUE_LABEL
-  elif _TRYBOT_READY_LABEL in labels_removed_by_bot:
-    return _TRYBOT_READY_LABEL
+  return _FindLabelToReapply(messages[failure_index+1:])
 
 
 def _FindLatestPreCQKickoff(messages):
@@ -161,36 +152,19 @@
       return i
 
 
-def _FindLabelsToReapply(messages):
-  """Finds the gerrit labels to reapply (probably the label removed by the bot)
+def _FindLabelToReapply(messages):
+  """Finds the gerrit label to reapply (probably the label removed by the bot)
 
   Args:
     messages: The gerrit comments after kickoff
 
   Returns:
-    A set of labels which were removed by the chromeos commit bot.
+    Label removed by the chromeos commit bot.
   """
-  labels_removed_by_bot = set()
   for message in messages:
-    if (message['real_author']['email']
-        == constants.CHROMEOS_COMMIT_BOT_EMAIL):
-      for label in (_TRYBOT_READY_LABEL, _COMMIT_QUEUE_LABEL):
-        if '-' + label in message['message']:
-          labels_removed_by_bot.add(label)
+    if ((message['real_author']['email']
+        == constants.CHROMEOS_COMMIT_BOT_EMAIL)
+        and '-' + _COMMIT_QUEUE_LABEL in message['message']):
+      return _COMMIT_QUEUE_LABEL
 
-  if labels_removed_by_bot:
-    return labels_removed_by_bot
-
-  # Special case - Commit-Queue+2 isn't removed by the bot. If the trybot was
-  # kicked off by CR+2, we want to reapply Trybot-Ready+1.
-  # We assume that if neither the bot nor a human removed any labels, then it
-  # was kicked off by CR+2
-  any_labels_removed = False
-  for message in messages:
-    for label in (_TRYBOT_READY_LABEL, _COMMIT_QUEUE_LABEL):
-      if '-' + label in message['message']:
-        any_labels_removed = True
-  if not any_labels_removed:
-    return [_TRYBOT_READY_LABEL]
-
-  return []
+  return None
diff --git a/exonerator/gerrit_precq_test.py b/exonerator/gerrit_precq_test.py
index ef8b89d..d3488c7 100644
--- a/exonerator/gerrit_precq_test.py
+++ b/exonerator/gerrit_precq_test.py
@@ -14,8 +14,8 @@
 from exonerator import gerrit_cq_test
 
 
-REMOVED_BY_HUMAN = 'Trybot-Ready_removed_by_human_*.json'
-REMOVED_BY_BOT = 'Trybot-Ready_removed_by_bot_*.json'
+REMOVED_BY_HUMAN = 'CQ+1_removed_by_human_*.json'
+REMOVED_BY_BOT = 'CQ+1_removed_by_bot_*.json'
 READY = 'precq_ready_for_exoneration_*.json'
 NOT_READY = 'precq_not_ready_for_exoneration_*.json'
 
diff --git a/exonerator/test_cases/Trybot-Ready_removed_by_bot_924657.json b/exonerator/test_cases/CQ+1_removed_by_bot_924657.json
similarity index 100%
rename from exonerator/test_cases/Trybot-Ready_removed_by_bot_924657.json
rename to exonerator/test_cases/CQ+1_removed_by_bot_924657.json
diff --git a/exonerator/test_cases/Trybot-Ready_removed_by_bot_930469.json b/exonerator/test_cases/CQ+1_removed_by_bot_930469.json
similarity index 100%
rename from exonerator/test_cases/Trybot-Ready_removed_by_bot_930469.json
rename to exonerator/test_cases/CQ+1_removed_by_bot_930469.json
diff --git a/exonerator/test_cases/Trybot-Ready_removed_by_human_936452.json b/exonerator/test_cases/CQ+1_removed_by_human_936452.json
similarity index 100%
rename from exonerator/test_cases/Trybot-Ready_removed_by_human_936452.json
rename to exonerator/test_cases/CQ+1_removed_by_human_936452.json
diff --git a/exonerator/test_cases/precq_ready_for_exoneration_924657.json b/exonerator/test_cases/precq_ready_for_exoneration_924657.json
index 0b0cded..531e18c 100644
--- a/exonerator/test_cases/precq_ready_for_exoneration_924657.json
+++ b/exonerator/test_cases/precq_ready_for_exoneration_924657.json
@@ -832,13 +832,10 @@
     }
   }, 
   "permitted_labels": {
-    "Trybot-Ready": [
-      " 0", 
-      "+1"
-    ], 
     "Commit-Queue": [
       " 0", 
-      "+1"
+      "+1",
+      "+2"
     ], 
     "Verified": [
       "-1",