repo_sync_manifest: Support --repo-url.

By default, repo makes network calls to its
remote git repository. This is a pain for
testing, so allow callers to specify a custom
URL (which can be a local file).

Change-Id: I694c4705e57df6ab1ab5da6093bb59d29cb29ef0
Reviewed-on: https://chromium-review.googlesource.com/1460272
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_unittest.py b/scripts/repo_sync_manifest_unittest.py
index 4644381..3e47144 100644
--- a/scripts/repo_sync_manifest_unittest.py
+++ b/scripts/repo_sync_manifest_unittest.py
@@ -30,6 +30,7 @@
 
   def setUp(self):
     self.repo_dir = os.path.join(self.tempdir, 'repo')
+    self.repo_url = os.path.join(self.tempdir, '.repo/repo')
     self.preload_src = os.path.join(self.tempdir, 'source')
     self.git_cache = os.path.join(self.tempdir, 'git_cache')
     self.manifest = os.path.join(self.tempdir, 'manifest.xml')
@@ -71,6 +72,7 @@
             manifest_repo_url=self.INT_MANIFEST_URL,
             branch='master',
             git_cache_dir=None,
+            repo_url=None,
         ),
         mock.call().Sync(detach=True, local_manifest=None)
     ])
@@ -91,6 +93,7 @@
             manifest_repo_url=self.EXT_MANIFEST_URL,
             branch='master',
             git_cache_dir=None,
+            repo_url=None,
         ),
         mock.call().Sync(detach=True, local_manifest=None)
     ])
@@ -111,6 +114,7 @@
             manifest_repo_url=self.manifest_url,
             branch='master',
             git_cache_dir=None,
+            repo_url=None,
         ),
         mock.call().Sync(detach=True, local_manifest=None)
     ])
@@ -128,6 +132,7 @@
             manifest_repo_url=self.INT_MANIFEST_URL,
             branch='branch',
             git_cache_dir=None,
+            repo_url=None,
         ),
         mock.call().Sync(detach=True, local_manifest=None)
     ])
@@ -158,6 +163,7 @@
             manifest_repo_url=self.INT_MANIFEST_URL,
             branch='master',
             git_cache_dir=None,
+            repo_url=None,
         ),
         mock.call().Sync(detach=True, local_manifest='resolved_buildspec')
     ])
@@ -186,6 +192,7 @@
             manifest_repo_url=self.EXT_MANIFEST_URL,
             branch='master',
             git_cache_dir=None,
+            repo_url=None,
         ),
         mock.call().Sync(detach=True, local_manifest='resolved_buildspec')
     ])
@@ -213,6 +220,7 @@
             manifest_repo_url=self.INT_MANIFEST_URL,
             branch='master',
             git_cache_dir=None,
+            repo_url=None,
         ),
         mock.call().Sync(detach=True, local_manifest='resolved_buildspec')
     ])
@@ -241,6 +249,7 @@
             manifest_repo_url=self.EXT_MANIFEST_URL,
             branch='master',
             git_cache_dir=None,
+            repo_url=None,
         ),
         mock.call().Sync(detach=True, local_manifest='resolved_buildspec')
     ])
@@ -275,6 +284,7 @@
             manifest_repo_url=self.INT_MANIFEST_URL,
             branch='master',
             git_cache_dir=None,
+            repo_url=None,
         ),
         mock.call().Sync(detach=True, local_manifest=self.manifest)
     ])
@@ -284,6 +294,7 @@
         '--repo-root', self.repo_dir,
         '--copy-repo', self.preload_src,
         '--git-cache', self.git_cache,
+        '--repo-url', self.repo_url,
     ])
 
     # Ensure manifest_versions is not updated.
@@ -296,6 +307,7 @@
             manifest_repo_url=self.INT_MANIFEST_URL,
             branch='master',
             git_cache_dir=self.git_cache,
+            repo_url=self.repo_url,
         ),
         mock.call().PreLoad(self.preload_src),
         mock.call().Sync(detach=True, local_manifest=None)