mirror of
https://gerrit.googlesource.com/git-repo
synced 2024-12-21 07:16:21 +00:00
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:
parent
9e7875315f
commit
7caa3658b2
@ -63,7 +63,7 @@ class Superproject(object):
|
|||||||
True if 'git clone <url> <branch>' is successful, or False.
|
True if 'git clone <url> <branch>' is successful, or False.
|
||||||
"""
|
"""
|
||||||
os.mkdir(self._superproject_path)
|
os.mkdir(self._superproject_path)
|
||||||
cmd = ['clone', url, '--filter', 'blob:none']
|
cmd = ['clone', url, '--depth', '1']
|
||||||
if branch:
|
if branch:
|
||||||
cmd += ['--branch', branch]
|
cmd += ['--branch', branch]
|
||||||
p = GitCommand(None,
|
p = GitCommand(None,
|
||||||
|
@ -61,6 +61,13 @@ class SuperprojectTestCase(unittest.TestCase):
|
|||||||
with mock.patch.object(self._superproject, '_Clone', return_value=False):
|
with mock.patch.object(self._superproject, '_Clone', return_value=False):
|
||||||
self._superproject.GetAllProjectsSHAs(url='localhost')
|
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):
|
def test_superproject_get_project_shas_mock_ls_tree(self):
|
||||||
"""Test with LsTree being a mock."""
|
"""Test with LsTree being a mock."""
|
||||||
data = ('120000 blob 158258bdf146f159218e2b90f8b699c4d85b5804\tAndroid.bp\x00'
|
data = ('120000 blob 158258bdf146f159218e2b90f8b699c4d85b5804\tAndroid.bp\x00'
|
||||||
|
Loading…
Reference in New Issue
Block a user