-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcheckout_all.py
32 lines (26 loc) · 917 Bytes
/
checkout_all.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
"""
Clones all public & private repos in your org.
If already cloned, switches to the default branch and pulls
latest changes.
"""
import logging
import sys
from github_helpers import (
clone_repo,
get_github_headers,
get_repos,
get_repo_path
)
logging.basicConfig(stream=sys.stderr, level=logging.INFO)
LOG = logging.getLogger(__name__)
def clone_all(org, root_dir):
gh_headers = get_github_headers()
for repo_data in get_repos(gh_headers, org, False):
(rname, ssh_url, dbranch, _, count) = repo_data
LOG.info("\n\n******* CHECKING REPO: {} ({}) ************".format(rname, count))
repo_path = get_repo_path(rname, root_dir)
# clone repo; if exists, checkout the default branch & pull latest
clone_repo(root_dir, repo_path, ssh_url, dbranch)
if __name__ == "__main__":
root_dir = "/Users/sarinacanelake/openedx/"
clone_all("openedx", root_dir)