Skip to content

Commit 2af9503

Browse files
author
Zachary 'Clack' Cole
authored
Merge pull request swiftlang#316 from apple/check-it-out
Fix checkout script
2 parents d218b67 + 5c97b07 commit 2af9503

File tree

3 files changed

+25
-2
lines changed

3 files changed

+25
-2
lines changed

checkout

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,7 @@ def main():
5959
continue
6060
total_repos += 1
6161
for compatible_swift in repo['compatibility']:
62-
project.checkout(root_path, repo,
63-
repo['compatibility'][compatible_swift]['commit'])
62+
project.checkout(root_path, repo, compatible_swift['commit'])
6463
common.debug_print('='*40)
6564
common.debug_print('Repository Summary:')
6665
common.debug_print(' Total: %s' % total_repos)

project.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,18 @@ def test_swift_package(path, swiftc, sandbox_profile,
238238
env=env)
239239

240240

241+
def checkout(root_path, repo, commit):
242+
"""Checkout an indexed repository."""
243+
path = os.path.join(root_path, repo['path'])
244+
if repo['repository'] == 'Git':
245+
if os.path.exists(path):
246+
return common.git_update(repo['url'], commit, path)
247+
else:
248+
return common.git_clone(repo['url'], path, tree=commit)
249+
raise common.Unreachable('Unsupported repository: %s' %
250+
repo['repository'])
251+
252+
241253
def strip_resource_phases(repo_path, stdout=sys.stdout, stderr=sys.stderr):
242254
"""Strip resource build phases from a given project."""
243255
command = ['perl', '-i', '-00ne',

project_future.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -234,6 +234,18 @@ def test_swift_package(path, swiftc, sandbox_profile,
234234
env=env)
235235

236236

237+
def checkout(root_path, repo, commit):
238+
"""Checkout an indexed repository."""
239+
path = os.path.join(root_path, repo['path'])
240+
if repo['repository'] == 'Git':
241+
if os.path.exists(path):
242+
return common.git_update(repo['url'], commit, path)
243+
else:
244+
return common.git_clone(repo['url'], path, tree=commit)
245+
raise common.Unreachable('Unsupported repository: %s' %
246+
repo['repository'])
247+
248+
237249
def strip_resource_phases(repo_path, stdout=sys.stdout, stderr=sys.stderr):
238250
"""Strip resource build phases from a given project."""
239251
command = ['perl', '-i', '-00ne',

0 commit comments

Comments
 (0)