Revert "cbuildbot_launch: Always wipe firmware/factory branches."

This reverts commit 094422f998d7cdc7bfd95a14177a8ed97beb242a.

Reason for revert:

This CL didn't fix the problem, and so hurts branched build performance for no reason.

Original change's description:
> cbuildbot_launch: Always wipe firmware/factory branches.
>
> We've had weird issues with cbuildbot on some firmware/factory
> branches doing weird things during cleanup. Instead of trying to fix
> cleanup on the branches, just make sure that they always have a clean
> slate. This is slower, and wasteful of GoB quota, but we perform very
> few builds on these branches, so it shouldn't be a big deal.
>
> BUG=chromium:780727
> TEST=run_tests + new unittests
>
> Change-Id: I8bd4bf776f717b5d837337ecefd4c83ca9172706
> Reviewed-on: https://chromium-review.googlesource.com/776273
> Commit-Ready: Don Garrett <dgarrett@chromium.org>
> Tested-by: Don Garrett <dgarrett@chromium.org>
> Reviewed-by: Don Garrett <dgarrett@chromium.org>

Bug: chromium:780727
Change-Id: I604392864c9dccfd2a6cef26049d20ed5761e5d9
Reviewed-on: https://chromium-review.googlesource.com/780259
Commit-Ready: Don Garrett <dgarrett@chromium.org>
Tested-by: Don Garrett <dgarrett@chromium.org>
Reviewed-by: Don Garrett <dgarrett@chromium.org>
diff --git a/scripts/cbuildbot_launch.py b/scripts/cbuildbot_launch.py
index 23e7540..bf77667 100644
--- a/scripts/cbuildbot_launch.py
+++ b/scripts/cbuildbot_launch.py
@@ -70,7 +70,7 @@
   return wrapped_functor
 
 
-def Field(fields, **kwargs):
+def field(fields, **kwargs):
   """Helper for inserting more fields into a metrics fields dictionary.
 
   Args:
@@ -154,22 +154,6 @@
   osutils.WriteFile(state_file, new_state)
 
 
-def WipeBuildRootHelper(root, metrics_fields, reason):
-  """Helper to safely blow away the entire buildroot.
-
-  Args:
-    root: Root directory owned by cbuildbot_launch.
-    metrics_fields: Dictionary of fields to include in metrics.
-    reason: Reason for wiping the buildroot for metrics.
-  """
-  metrics.Counter(METRIC_CLOBBER).increment(
-      Field(metrics_fields, reason=reason))
-  chroot_dir = os.path.join(root, 'chroot')
-  if os.path.exists(chroot_dir) or os.path.exists(chroot_dir + '.img'):
-    cros_build_lib.CleanupChrootMount(chroot_dir, delete_image=True)
-  osutils.RmDir(root, ignore_missing=True, sudo=True)
-
-
 @StageDecorator
 def CleanBuildRoot(root, repo, metrics_fields):
   """Some kinds of branch transitions break builds.
@@ -185,22 +169,20 @@
   """
   old_buildroot_layout, old_branch = GetState(root)
 
-  # Do the cleanups, along with metrics.
   if old_buildroot_layout != BUILDROOT_BUILDROOT_LAYOUT:
     logging.PrintBuildbotStepText('Unknown layout: Wiping buildroot.')
-    WipeBuildRootHelper(root, metrics_fields, 'layout_change')
-
-  elif (repo.branch.startswith('firmware') or
-        repo.branch.startswith('factory')):
-    logging.PrintBuildbotStepText('Firmware/Factory Branch: Wiping buildroot.')
-    WipeBuildRootHelper(root, metrics_fields, 'firmware_factory')
-
+    metrics.Counter(METRIC_CLOBBER).increment(
+        field(metrics_fields, reason='layout_change'))
+    chroot_dir = os.path.join(root, 'chroot')
+    if os.path.exists(chroot_dir) or os.path.exists(chroot_dir + '.img'):
+      cros_build_lib.CleanupChrootMount(chroot_dir, delete_image=True)
+    osutils.RmDir(root, ignore_missing=True, sudo=True)
   else:
     if old_branch != repo.branch:
       logging.PrintBuildbotStepText('Branch change: Cleaning buildroot.')
       logging.info('Unmatched branch: %s -> %s', old_branch, repo.branch)
       metrics.Counter(METRIC_BRANCH_CLEANUP).increment(
-          Field(metrics_fields, old_branch=old_branch))
+          field(metrics_fields, old_branch=old_branch))
 
       logging.info('Remove Chroot.')
       chroot_dir = os.path.join(repo.directory, 'chroot')
@@ -218,7 +200,7 @@
     except Exception:
       logging.info('Checkout cleanup failed, wiping buildroot:', exc_info=True)
       metrics.Counter(METRIC_CLOBBER).increment(
-          Field(metrics_fields, reason='repo_cleanup_failure'))
+          field(metrics_fields, reason='repo_cleanup_failure'))
       repository.ClearBuildRoot(repo.directory)
 
   # Ensure buildroot exists. Save the state we are prepped for.