summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorRaman Tenneti <rtenneti@google.com>2021-06-08 10:46:51 -0700
committerRaman Tenneti <rtenneti@google.com>2021-06-08 22:43:32 +0000
commit50c91ecf4f313a223bc6737d047fc32d665db0fd (patch)
treef24cce4175b371b9cf6a1d8b677984acda028924 /tests
parent816d82c010e02d3d8deb74f64628e8aab5e1d6b1 (diff)
downloadgit-repo-50c91ecf4f313a223bc6737d047fc32d665db0fd.tar.gz
superproject: revert not updating commit ids if remote is different.
superproject supports multiple remotes. Get all commit ids from superproject for all projects that are in the manifest. $ ./run_tests -v Bug: [google internal] b/186395810 Change-Id: I6edce3918853a7a3a65aec5528e6a43a544eff53 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/308862 Tested-by: Raman Tenneti <rtenneti@google.com> Reviewed-by: Jonathan Nieder <jrn@google.com> Reviewed-by: Mike Frysinger <vapier@google.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/test_git_superproject.py45
1 files changed, 0 insertions, 45 deletions
diff --git a/tests/test_git_superproject.py b/tests/test_git_superproject.py
index b1ae3576..707f7dab 100644
--- a/tests/test_git_superproject.py
+++ b/tests/test_git_superproject.py
@@ -178,51 +178,6 @@ class SuperprojectTestCase(unittest.TestCase):
178 '<superproject name="superproject"/>' 178 '<superproject name="superproject"/>'
179 '</manifest>') 179 '</manifest>')
180 180
181 def test_superproject_update_project_revision_id_with_different_remotes(self):
182 """Test update of commit ids of a manifest with mutiple remotes."""
183 manifest = self.getXmlManifest("""
184<manifest>
185 <remote name="default-remote" fetch="http://localhost" />
186 <remote name="goog" fetch="http://localhost2" />
187 <default remote="default-remote" revision="refs/heads/main" />
188 <superproject name="superproject"/>
189 <project path="vendor/x" name="platform/vendor/x" remote="goog" groups="vendor"
190 revision="master-with-vendor" clone-depth="1" />
191 <project path="art" name="platform/art" groups="notdefault,platform-""" + self.platform + """
192 " /></manifest>
193""")
194 self.maxDiff = None
195 self._superproject = git_superproject.Superproject(manifest, self.repodir)
196 self.assertEqual(len(self._superproject._manifest.projects), 2)
197 projects = self._superproject._manifest.projects
198 data = ('160000 commit 2c2724cb36cd5a9cec6c852c681efc3b7c6b86ea\tart\x00'
199 '160000 commit e9d25da64d8d365dbba7c8ee00fe8c4473fe9a06\tbootable/recovery\x00')
200 with mock.patch.object(self._superproject, '_Init', return_value=True):
201 with mock.patch.object(self._superproject, '_Fetch', return_value=True):
202 with mock.patch.object(self._superproject,
203 '_LsTree',
204 return_value=data):
205 # Create temporary directory so that it can write the file.
206 os.mkdir(self._superproject._superproject_path)
207 manifest_path = self._superproject.UpdateProjectsRevisionId(projects)
208 self.assertIsNotNone(manifest_path)
209 with open(manifest_path, 'r') as fp:
210 manifest_xml = fp.read()
211 self.assertEqual(
212 sort_attributes(manifest_xml),
213 '<?xml version="1.0" ?><manifest>'
214 '<remote fetch="http://localhost" name="default-remote"/>'
215 '<remote fetch="http://localhost2" name="goog"/>'
216 '<default remote="default-remote" revision="refs/heads/main"/>'
217 '<project groups="notdefault,platform-' + self.platform + '" '
218 'name="platform/art" path="art" '
219 'revision="2c2724cb36cd5a9cec6c852c681efc3b7c6b86ea"/>'
220 '<project clone-depth="1" groups="vendor" '
221 'name="platform/vendor/x" path="vendor/x" remote="goog" '
222 'revision="master-with-vendor"/>'
223 '<superproject name="superproject"/>'
224 '</manifest>')
225
226 181
227if __name__ == '__main__': 182if __name__ == '__main__':
228 unittest.main() 183 unittest.main()