Skip to content

Conversation

charles-zablit
Copy link
Contributor

@charles-zablit charles-zablit commented Sep 3, 2025

This patch adds a check for locked repositories in update_checkout.

If a repository is locked by another program (or if a .lock file was not properly deleted by git), update_checkout will hang on a random repository. The error message will be spread across multiple cloning logs.

Before running the update part of update-checkout, we check if there is any locked repository and prompt the user to fix the issue before returning early. If libxml2 is locked:

C:\S>python "C:\S\swift\utils\\update-checkout" --reset-to-remote --scheme main --skip-repository llvm-project
+ pushd 'C:\S\swift'
+ popd
Skipping update of 'llvm-project', requested by user
======UPDATE FAILURES======
'libxml2' is locked by git. Cannot update it.
update-checkout failed, fix errors and try again

The added tests were ran at desk.

rdar://159749530

@charles-zablit charles-zablit self-assigned this Sep 3, 2025
@charles-zablit charles-zablit added the update-checkout Area → utils: the `update-checkout` script label Sep 3, 2025
@charles-zablit
Copy link
Contributor Author

@swift-ci please test

@charles-zablit charles-zablit force-pushed the charles-zablit/update-checkout/add-locked-repository-check branch from d443280 to 1122439 Compare September 3, 2025 12:19
@charles-zablit
Copy link
Contributor Author

@swift-ci please smoke test

locked_repositories: set[str] = _is_any_repository_locked(pool_args)
if len(locked_repositories) > 0:
return [
f"'{repo_name}' is locked by git. Cannot update it."
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in what exit status does this result?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This adds an error to the results variable, which is passed to the check_parallel_results function. The exit status is 1.

./swift/utils/update-checkout --scheme release/6.2.1 --skip-repository swift || echo $?
+ pushd /Users/charleszablit/Developer/lldb/swift
+ popd
Skipping update of 'swift', requested by user
======UPDATE FAILURES======
'llvm-project' is locked by git. Cannot update it.
update-checkout failed, fix errors and try again
1

@charles-zablit charles-zablit merged commit 763d71d into swiftlang:main Sep 5, 2025
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

update-checkout Area → utils: the `update-checkout` script

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants