repo_sync_manifest: Support custom manifest url.

Originall, repo_sync_manifest always provided the
URL to the internal or external manifest to repo sync.
This is prohibitive for tests that depend on repo_sync_manifest
and that don't want to make network calls. Therefore, allow
callers to directly specify the manifest URL (in tests
this can be a location on disk).

Change-Id: Ib5c8847e4cb7f09c96e2d2a83ba92a47f35c0662
Reviewed-on: https://chromium-review.googlesource.com/1460271
Commit-Ready: Evan Hernandez <evanhernandez@chromium.org>
Tested-by: Evan Hernandez <evanhernandez@chromium.org>
Reviewed-by: Jason Clinton <jclinton@chromium.org>
diff --git a/scripts/repo_sync_manifest.py b/scripts/repo_sync_manifest.py
index 8d52d81..a23447d 100644
--- a/scripts/repo_sync_manifest.py
+++ b/scripts/repo_sync_manifest.py
@@ -55,11 +55,14 @@
       '--manifest-file', type='path',
       help='Sync to an existing local manifest file.')
 
-  manifest_group.add_argument(
+  manifest_url_ex = manifest_group.add_mutually_exclusive_group()
+  manifest_url_ex.add_argument(
       '--external', action='store_true', default=False,
       help='Sync to the external version of a manifest. Switch from '
            'manifest-versions-internal to manifest-versions for buildspecs. '
            'Not usable with --manifest.')
+  manifest_url_ex.add_argument(
+      '--manifest-url', help='Manually set URL to fetch repo manifest from.')
 
   patch_group = parser.add_argument_group(
       'Patch',
@@ -179,7 +182,9 @@
   if local_manifest:
     logging.info('Using local_manifest: %s', local_manifest)
 
-  if options.external:
+  if options.manifest_url:
+    manifest_url = options.manifest_url
+  elif options.external:
     manifest_url = config_lib.GetSiteParams().MANIFEST_URL
   else:
     manifest_url = config_lib.GetSiteParams().MANIFEST_INT_URL