Skip to content

Commit ceb71b5

Browse files
authored
Merge pull request #3065 from gottesmm/small-update-checkout-gardenings
Small update checkout gardenings
2 parents 9a6e4f6 + b727977 commit ceb71b5

File tree

1 file changed

+40
-37
lines changed

1 file changed

+40
-37
lines changed

utils/update-checkout

Lines changed: 40 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -58,44 +58,47 @@ def update_working_copy(repo_path, branch):
5858

5959
def obtain_additional_swift_sources(
6060
config, with_ssh, branch, skip_history, skip_repositories):
61-
for dir_name, repo_info in config['repositories'].items():
62-
repo = repo_info['name']
63-
if dir_name in skip_repositories:
64-
print("--- Skipping '" + dir_name + "' ---")
65-
continue
66-
with shell.pushd(SWIFT_SOURCE_ROOT, dry_run=False,
67-
echo=False):
68-
if not os.path.isdir(os.path.join(dir_name, ".git")):
69-
print("--- Cloning '" + dir_name + "' ---")
70-
71-
# If we have a url override, use that url instead of
72-
# interpolating.
73-
if 'url' in repo_info:
74-
remote = repo_info['url']
75-
elif with_ssh is True or 'https-clone-pattern' not in config:
76-
remote = config['ssh-clone-pattern'] % repo
77-
else:
78-
remote = config['https-clone-pattern'] % repo
79-
if skip_history:
80-
shell.call(['git', 'clone', '--recursive', '--depth', '1',
81-
remote, dir_name], echo=False)
61+
with shell.pushd(SWIFT_SOURCE_ROOT, dry_run=False,
62+
echo=False):
63+
for dir_name, repo_info in config['repositories'].items():
64+
repo = repo_info['name']
65+
if dir_name in skip_repositories:
66+
print("--- Skipping '" + dir_name + "' ---")
67+
continue
68+
69+
if os.path.isdir(os.path.join(dir_name, ".git")):
70+
continue
71+
72+
print("--- Cloning '" + dir_name + "' ---")
73+
74+
# If we have a url override, use that url instead of
75+
# interpolating.
76+
if 'url' in repo_info:
77+
remote = repo_info['url']
78+
elif with_ssh is True or 'https-clone-pattern' not in config:
79+
remote = config['ssh-clone-pattern'] % repo
80+
else:
81+
remote = config['https-clone-pattern'] % repo
82+
if skip_history:
83+
shell.call(['git', 'clone', '--recursive', '--depth', '1',
84+
remote, dir_name], echo=False)
85+
else:
86+
shell.call(['git', 'clone', '--recursive', remote,
87+
dir_name], echo=False)
88+
if branch:
89+
for config_branch_name in config['branch-names']:
90+
if branch not in config[config_branch_name]['aliases']:
91+
continue
92+
repo_branch = \
93+
config[config_branch_name]['repos'][dir_name]
94+
break
8295
else:
83-
shell.call(['git', 'clone', '--recursive', remote,
84-
dir_name], echo=False)
85-
if branch:
86-
for config_branch_name in config['branch-names']:
87-
if branch not in config[config_branch_name]['aliases']:
88-
continue
89-
repo_branch = \
90-
config[config_branch_name]['repos'][dir_name]
91-
break
92-
else:
93-
repo_branch = branch
94-
src_path = os.path.join(SWIFT_SOURCE_ROOT, dir_name,
95-
".git")
96-
shell.call(['git', '--git-dir', src_path, '--work-tree',
97-
os.path.join(SWIFT_SOURCE_ROOT, dir_name),
98-
'checkout', repo_branch], echo=False)
96+
repo_branch = branch
97+
src_path = os.path.join(SWIFT_SOURCE_ROOT, dir_name,
98+
".git")
99+
shell.call(['git', '--git-dir', src_path, '--work-tree',
100+
os.path.join(SWIFT_SOURCE_ROOT, dir_name),
101+
'checkout', repo_branch], echo=False)
99102

100103

101104
def validate_config(config):

0 commit comments

Comments
 (0)