repo for all except some projects not all. is there a repo command to do this?

11,496

Solution 1

With repo forall you can specify which projects the command should apply to, but there's no way of expressing "all projects except these N projects" (unless you can express the projects you want it to apply to using a regular expression, but that's not likely).

What you can do is produce a list of all projects, e.g. with

repo forall -c 'echo $REPO_PROJECT'

and remove the projects you've rebased and want to exclude, e.g. by piping the output to grep -v or by redirecting the output to a file and editing that file by hand. Then feed that project list to repo forall. Two examples:

repo forall -c 'echo $REPO_PROJECT' > projects
vi projects
repo forall $(cat projects) -c 'git checkout'

repo forall $(repo forall -c 'echo $REPO_PROJECT' | grep -v name/of/project) -c 'git checkout'

Solution 2

Use -i or -r. i.e. repo forall -i bypass git fetch

-r, --regex           Execute the command only on projects matching regex or
                    wildcard expression
-i, --inverse-regex   Execute the command only on projects not matching
                    regex or wildcard expression
Share:
11,496
spitfire88
Author by

spitfire88

Linux Kernel, Android (Things) Developer.

Updated on June 26, 2022

Comments

  • spitfire88
    spitfire88 almost 2 years

    I have tried googling this but havent found anything relavant to what im looking for. I have a few projects in android that i have rebased to the tip. After doing that I would like to move all the remaining projects to the tip.

    The below command will checkout all the projects to the tag. repo forall -c "git checkout "

    I would like to skip the ones that i have rebased manually.

    Appreciate your help. Thanks!

  • GilCol
    GilCol over 5 years
    The -i flag is not available on versions pre 1.12.34