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 <rtenneti@google.com>
Change-Id: I7e4b1e51ca1d18b836a5fa8d139a0765262ba500
This commit is contained in:
Raman Tenneti
2021-02-01 11:15:16 -08:00
parent 9e7875315f
commit 7caa3658b2
2 changed files with 8 additions and 1 deletions

View File

@@ -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'