Allow a single project to map to multiple paths.

Right now, cbuildbot assumes that each project maps to a single path.
To fix this, I've updated all remaining callers to use new APIs that
allow for each project to map to multiple checkouts.

BUG=chromium:314917
TEST=unit tests
TEST=paladin, canary, chromiumos-sdk trybots
TEST=create branch using branchutil
TEST=merge change with cros_merge_to_branch
TEST=Run cros_list_modified_packages
TEST=Merge a change using autotest_quickmerge

Change-Id: I1cb99705e8af99b97e048a8604014b0a0d046b6a
Reviewed-on: https://chromium-review.googlesource.com/176363
Reviewed-by: Matt Tennant <mtennant@chromium.org>
Tested-by: David James <davidjames@chromium.org>
Commit-Queue: David James <davidjames@chromium.org>
diff --git a/scripts/cros_merge_to_branch.py b/scripts/cros_merge_to_branch.py
index 20e17cb..04179ac 100644
--- a/scripts/cros_merge_to_branch.py
+++ b/scripts/cros_merge_to_branch.py
@@ -152,8 +152,8 @@
   # ManifestCheckout object.
   reference = None
   if manifest:
-    reference = os.path.join(constants.SOURCE_ROOT,
-                             manifest.GetProjectPath(patch.project))
+    path = patch.GetCheckout(manifest)['path']
+    reference = os.path.join(constants.SOURCE_ROOT, path)
     if not os.path.isdir(reference):
       logging.error('Unable to locate git checkout: %s', reference)
       logging.error('Did you mean to use --nomirror?')
@@ -191,11 +191,7 @@
     patches - a collection GerritPatch objects.
   """
   for patch in patches:
-    project_path = None
-    if manifest.ProjectExists(patch.project):
-      project_path = manifest.GetProjectPath(patch.project)
-
-    if not project_path:
+    if not patch.GetCheckout(manifest, strict=False):
       logging.error('Your manifest does not have the repository %s for '
                     'change %s. Please re-run with --nomirror and '
                     '--email set', patch.project, patch.gerrit_number)