From 7caa3658b2d9c7f8d48d8c659a39bb412037f74f Mon Sep 17 00:00:00 2001 From: Raman Tenneti Date: Mon, 1 Feb 2021 11:15:16 -0800 Subject: sync: Do a git pull with --use-superproject if superproject tree already exists. Tested the code with the following commands. $ ./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 doing a repo sync --use-superproject twice. .../WORKING_DIRECTORY$ repo sync --use-superproject Bug: https://crbug.com/gerrit/13709 Bug: https://crbug.com/gerrit/13707 Tested-by: Raman Tenneti Change-Id: I7e4b1e51ca1d18b836a5fa8d139a0765262ba500 --- tests/test_git_superproject.py | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'tests/test_git_superproject.py') diff --git a/tests/test_git_superproject.py b/tests/test_git_superproject.py index 67a75a17..4012ec26 100644 --- a/tests/test_git_superproject.py +++ b/tests/test_git_superproject.py @@ -61,6 +61,13 @@ class SuperprojectTestCase(unittest.TestCase): with mock.patch.object(self._superproject, '_Clone', return_value=False): self._superproject.GetAllProjectsSHAs(url='localhost') + def test_superproject_get_project_shas_mock_pull(self): + """Test with _Pull failing.""" + with self.assertRaises(GitError): + with mock.patch.object(self._superproject, '_Clone', return_value=True): + with mock.patch.object(self._superproject, '_Pull', return_value=False): + self._superproject.GetAllProjectsSHAs(url='localhost') + def test_superproject_get_project_shas_mock_ls_tree(self): """Test with LsTree being a mock.""" data = ('120000 blob 158258bdf146f159218e2b90f8b699c4d85b5804\tAndroid.bp\x00' -- cgit v1.2.3-54-g00ecf