Utils/update-checkout: how to checkout all dependency repositories of my current HEAD?

I do not want anything fancy here. I have a branch with my HEAD which has the default json update-checkout-config.json where all the dependency repositories are defined.
All I need is to update all the dependency repositories according to the config.
This is needed when I switch branches which are not always 100% up to date with main.

When I start the script it switches to main, merges origin/main and rebases all dependency repositories.

Expected result:
I have the default config which has all the tags, main, whatever and I just need it to checkout all the dependency repositories which fits my current commit/HEAD. I obviously also do not want it to switch to main or anything else. I expected this to be the default behaviour of the script. Did I miss anything? How do I get my expected behaviour?

Any help is really appreciated here.

1 Like

Can you please share the commands you are using with the update-checkout.py script?

./utils/update-checkout —clone-with-ssh and ./utils/update-checkout without options.

Hmm that's weird. What I use is:

./utils/update-checkout --clone --scheme main

And I have no issues with that when I'm on main branch. If I want to build a tag, I do:

./utils/update-checkout --clone --tag swift-DEVELOPMENT-SN APSHOT-2025-01-10-a

For example...

1 Like

I am not on main. I am on my branch.

Actual behaviour:
It switches to main, merges main and updates all dependency repostories according the json config.

Expected behaviour:
It does not switch branches, it also does not need to update main. It updates the dependency repositories according to my last commit‘s timestamp. I do not want to update my main and all its dependency repositories every day since I need to recompile everything. I just want to implement my code and test it. I check on github if there are any merge conflicts to main. If so I will make sure to merge with main, but in all other cases I do not need to have today’s main. Last week’s main is just fine to work on my small code implementations.

This is the expected behavior, since the main purpose of the script is to get clones into a state corresponding to a scheme used on CI. If you don't want a specific repository to switch to scheme's branch, you can specify --skip-repository <name_of_repo_skipped_for_scheme>.

1 Like

If you just want to match timestamps, you can do:

./utils/update-checkout --scheme main --match-timestamp --skip-repository swift

You'd need to make sure you're checking out the root of the branch you're working on prior to running to avoid it being affected by any additional commits you're making though

Thanks Max and hamish. This is what I needed. I wonder why this is not a default. How do people handle all the dependency repositories?

1 Like

If this were a default, CI build's wouldn't work correctly, since you need latest code in a CI job in the first place. Maybe --match-timestamp would make sense, but there are opinions on its usefulness, since again it doesn't replicate the established Swift CI behavior. --skip-repository is definitely context-dependent, there can be no true default value for it, since there's no way to know upfront which exact repositories a user would like to skip during their checkout process. Hence it must be explicit.