Skip to content

Instantly share code, notes, and snippets.

@thcipriani
Last active May 24, 2023 20:31
Show Gist options
  • Save thcipriani/38db4833be197a10d6d7092cdb1e0306 to your computer and use it in GitHub Desktop.
Save thcipriani/38db4833be197a10d6d7092cdb1e0306 to your computer and use it in GitHub Desktop.

Cloning All Gerrit Repos

I'm doing this with the myrepos perl script. I started down the path of reimplementing a good chunk of functionality of myrepos before realizing my mistake and generating a config file instead :)

To generate the config file I used this beauty:

while read repo; do
    printf '[%s]\n%s\n\n' "${repo}.git" "checkout = git clone --mirror https://gerrit-replica.wikimedia.org/r/${repo}"
done < <(curl -sL https://gerrit.wikimedia.org/r/projects/?all | \
    tail -c +6 | \
    jq -r '.|to_entries|map(select(.value.state == "ACTIVE"))|.[].key') > .mrconfig

From there a full mirror was a mr checkout away.

@thcipriani
Copy link
Author

I add

[DEFAULT]
update = git remote update
countobjects = git count-objects
du = du -cks | grep -v total

at the top of mrconfig ...for some reason

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment