Skip to content

Commit 9d29995

Browse files
committed
update-checkout: add type hints to confirm_tag_in_repo
1 parent 0d5bc9f commit 9d29995

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

utils/update_checkout/update_checkout/update_checkout.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ def check_parallel_results(results, op):
7575

7676

7777
def confirm_tag_in_repo(tag, repo_name):
78+
# type: (str, str) -> str | None
7879
"""Confirm that a given tag exists in a git repository. This function
7980
assumes that the repository is already a current working directory before
8081
it's called.
@@ -84,7 +85,8 @@ def confirm_tag_in_repo(tag, repo_name):
8485
repo_name (str): name the repository for the look up, used for logging
8586
8687
Returns:
87-
str: returns `tag` argument value or `None` if the tag doesn't exist.
88+
str | None: returns `tag` argument value or `None` if the tag doesn't
89+
exist.
8890
"""
8991

9092
tag_exists = shell.capture(['git', 'ls-remote', '--tags',
@@ -280,7 +282,7 @@ def get_timestamp_to_match(match_timestamp, source_root):
280282
str | None: a timestamp of the last commit of `swift` repository if
281283
`match_timestamp` argument has a value, `None` if `match_timestamp` is
282284
falsy.
283-
"""
285+
"""
284286
if not match_timestamp:
285287
return None
286288
with shell.pushd(os.path.join(source_root, "swift"),
@@ -687,6 +689,7 @@ def main():
687689
scheme_map = get_scheme_map(config, scheme_name)
688690

689691
clone_results = None
692+
skip_repo_list = []
690693
if clone or clone_with_ssh:
691694
skip_repo_list = skip_list_for_platform(config, all_repos)
692695
skip_repo_list.extend(args.skip_repository_list)
@@ -698,7 +701,7 @@ def main():
698701
skip_repo_list)
699702

700703
swift_repo_path = os.path.join(args.source_root, 'swift')
701-
if not 'swift' in skip_repo_list and os.path.exists(swift_repo_path):
704+
if 'swift' not in skip_repo_list and os.path.exists(swift_repo_path):
702705
with shell.pushd(swift_repo_path, dry_run=False, echo=True):
703706
# Check if `swift` repo itself needs to switch to a cross-repo branch.
704707
branch_name, cross_repo = get_branch_for_repo(config, 'swift',

0 commit comments

Comments
 (0)