ingydotnet / git-subrepo

MIT License
3.18k stars 263 forks source link

Pull multiple subrepo in one command #591

Closed ChristopheCaron closed 4 days ago

ChristopheCaron commented 1 year ago

We used multiples subrepos in a parent repo, To update quickly each subrepo, I would like to know if there is a shortcut or idea to subrepo pull each subrepo in one command (instead use && to chain subrepo pull command) . It would be a great feature if not already possible.

Thanks

betoop commented 10 months ago

Have you tried run the subrepo pull command with parallel?

admorgan commented 10 months ago

Would you expect the pulls to be part of a single commit, or in individual commits? If you expect individual commits you can use git subrepo pull --all

hakanderyal commented 8 months ago

git subrepo pull --all does the job, but it's noisy with multiple subrepos. Any other way to update all with one commit?

Or would it be easy to write a script that squashes consequent subrepo merge commits into one and updating the .gitrepo with the new commit hash?

admorgan commented 8 months ago

It isn't generally advised to pull all subrepos in one commit. The reason for this is that if there are local changes the amount of work required by subrepo to perform operations gets expensive if you are mixing a lot of surepos into one change. If you never deviate from upstream the .girepo file will reflect that and it doesn't really cost anything because the SHAs in the .gitrepo file allow the tools to skip those steps.

It is possible to do the described merge and a script that stored the current SHA of the repo, performed the git subrepo pulll --all then performed a rebase applying any subrepo patches after the first as fixups and handling the combination of merge messages is possible, but I don't currently have time to write one.