Skip to content

Commit 0d5bc9f

Browse files
committed
update-checkout: expand docstrings, fix missing options
1 parent ba7b458 commit 0d5bc9f

File tree

1 file changed

+24
-5
lines changed

1 file changed

+24
-5
lines changed

utils/update_checkout/update_checkout/update_checkout.py

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,19 @@ def update_single_repository(pool_args):
268268

269269

270270
def get_timestamp_to_match(match_timestamp, source_root):
271-
# type: (str, str) -> str | None
271+
# type: (str | None, str) -> str | None
272+
"""Computes a timestamp of the last commit on the current branch in
273+
the `swift` repository.
274+
275+
Args:
276+
match_timestamp (str | None): value of `--match-timestamp` to check.
277+
source_root (str): directory that contains sources of the Swift project.
278+
279+
Returns:
280+
str | None: a timestamp of the last commit of `swift` repository if
281+
`match_timestamp` argument has a value, `None` if `match_timestamp` is
282+
falsy.
283+
"""
272284
if not match_timestamp:
273285
return None
274286
with shell.pushd(os.path.join(source_root, "swift"),
@@ -511,16 +523,22 @@ def full_target_name(repository, target):
511523
raise RuntimeError('Cannot determine if %s is a branch or a tag' % target)
512524

513525

514-
def skip_list_for_platform(config):
515-
"""Computes a list of repositories to skip when updating or cloning.
526+
def skip_list_for_platform(config, all_repos):
527+
"""Computes a list of repositories to skip when updating or cloning, if not
528+
overriden by `--all-repositories` CLI argument.
516529
517530
Args:
518531
config (Dict[str, Any]): deserialized `update-checkout-config.json`
532+
all_repos (List[str]): repositories not required for current platform.
519533
520534
Returns:
521-
List[str]: a resulting list of repositories to skip.
535+
List[str]: a resulting list of repositories to skip or empty list if
536+
`all_repos` is not empty.
522537
"""
523538

539+
if all_repos:
540+
return [] # Do not skip any platform-specific repositories
541+
524542
# If there is a platforms key only include the repo if the
525543
# platform is in the list
526544
skip_list = []
@@ -647,6 +665,7 @@ def main():
647665
skip_tags = args.skip_tags
648666
scheme_name = args.scheme
649667
github_comment = args.github_comment
668+
all_repos = args.all_repositories
650669

651670
with open(args.config) as f:
652671
config = json.load(f)
@@ -669,7 +688,7 @@ def main():
669688

670689
clone_results = None
671690
if clone or clone_with_ssh:
672-
skip_repo_list = skip_list_for_platform(config)
691+
skip_repo_list = skip_list_for_platform(config, all_repos)
673692
skip_repo_list.extend(args.skip_repository_list)
674693
clone_results = obtain_all_additional_swift_sources(args, config,
675694
clone_with_ssh,

0 commit comments

Comments
 (0)