summaryrefslogtreecommitdiffstats
path: root/tests/test_manifest_xml.py
diff options
context:
space:
mode:
authorRaman Tenneti <rtenneti@google.com>2021-01-14 19:17:50 -0800
committerRaman Tenneti <rtenneti@google.com>2021-01-21 19:41:52 +0000
commit6a872c9daeec58dda61786e6f65591330709f6ad (patch)
treedcd22dcc29c91de8a097cf7075400bb463ef40e0 /tests/test_manifest_xml.py
parentdf6c506a8af47c19e853c96ba15e4446f93304b2 (diff)
downloadgit-repo-6a872c9daeec58dda61786e6f65591330709f6ad.tar.gz
sync: Added --use-superproject option and support for superproject.v2.12
Added "--use-superporject" option to sync.py to fetch project SHAs from superproject. If there are any missing projects in superprojects, it prints the missing entries and exits. If there are no missing entries, it will use SHAs from superproject to fetch the projects from git. Tested the code with the following commands. $ ./run_tests tests/test_manifest_xml.py $ ./run_tests -v tests/test_git_superproject.py $ ./run_tests -v Tested the sync code by copying all the repo changes into my Android AOSP checkout and adding <superporject> tag to default.xml. With local modification to the code to print the status, .../WORKING_DIRECTORY$ repo sync --use-superproject repo: executing 'git clone' url: sso://android/platform/superproject repo: executing 'git ls-tree' Success: [] Bug: https://crbug.com/gerrit/13709 Tested-by: Raman Tenneti <rtenneti@google.com> Change-Id: Id18665992428dd684c04b0e0b3a52f46316873a0 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/293822 Reviewed-by: Mike Frysinger <vapier@google.com>
Diffstat (limited to 'tests/test_manifest_xml.py')
-rw-r--r--tests/test_manifest_xml.py14
1 files changed, 8 insertions, 6 deletions
diff --git a/tests/test_manifest_xml.py b/tests/test_manifest_xml.py
index e2c83af9..370eb4f5 100644
--- a/tests/test_manifest_xml.py
+++ b/tests/test_manifest_xml.py
@@ -232,6 +232,7 @@ class XmlManifestTests(unittest.TestCase):
232""") 232""")
233 self.assertEqual(manifest.superproject['name'], 'superproject') 233 self.assertEqual(manifest.superproject['name'], 'superproject')
234 self.assertEqual(manifest.superproject['remote'].name, 'test-remote') 234 self.assertEqual(manifest.superproject['remote'].name, 'test-remote')
235 self.assertEqual(manifest.superproject['remote'].url, 'http://localhost/superproject')
235 self.assertEqual( 236 self.assertEqual(
236 manifest.ToXml().toxml(), 237 manifest.ToXml().toxml(),
237 '<?xml version="1.0" ?><manifest>' + 238 '<?xml version="1.0" ?><manifest>' +
@@ -245,20 +246,21 @@ class XmlManifestTests(unittest.TestCase):
245 manifest = self.getXmlManifest(""" 246 manifest = self.getXmlManifest("""
246<manifest> 247<manifest>
247 <remote name="default-remote" fetch="http://localhost" /> 248 <remote name="default-remote" fetch="http://localhost" />
248 <remote name="test-remote" fetch="http://localhost" /> 249 <remote name="superproject-remote" fetch="http://localhost" />
249 <default remote="default-remote" revision="refs/heads/main" /> 250 <default remote="default-remote" revision="refs/heads/main" />
250 <superproject name="superproject" remote="test-remote"/> 251 <superproject name="platform/superproject" remote="superproject-remote"/>
251</manifest> 252</manifest>
252""") 253""")
253 self.assertEqual(manifest.superproject['name'], 'superproject') 254 self.assertEqual(manifest.superproject['name'], 'platform/superproject')
254 self.assertEqual(manifest.superproject['remote'].name, 'test-remote') 255 self.assertEqual(manifest.superproject['remote'].name, 'superproject-remote')
256 self.assertEqual(manifest.superproject['remote'].url, 'http://localhost/platform/superproject')
255 self.assertEqual( 257 self.assertEqual(
256 manifest.ToXml().toxml(), 258 manifest.ToXml().toxml(),
257 '<?xml version="1.0" ?><manifest>' + 259 '<?xml version="1.0" ?><manifest>' +
258 '<remote name="default-remote" fetch="http://localhost"/>' + 260 '<remote name="default-remote" fetch="http://localhost"/>' +
259 '<remote name="test-remote" fetch="http://localhost"/>' + 261 '<remote name="superproject-remote" fetch="http://localhost"/>' +
260 '<default remote="default-remote" revision="refs/heads/main"/>' + 262 '<default remote="default-remote" revision="refs/heads/main"/>' +
261 '<superproject name="superproject" remote="test-remote"/>' + 263 '<superproject name="platform/superproject" remote="superproject-remote"/>' +
262 '</manifest>') 264 '</manifest>')
263 265
264 def test_superproject_with_defalut_remote(self): 266 def test_superproject_with_defalut_remote(self):