-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathpushFilesToRepo.py
More file actions
executable file
·63 lines (36 loc) · 1.57 KB
/
pushFilesToRepo.py
File metadata and controls
executable file
·63 lines (36 loc) · 1.57 KB
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#!/usr/bin/python
# This script takes a lab number such as lab00 as the command line argument,
# and tries to update all of the lab00_* repos in the
# UCSB-CS56-S13 organization by deleting all files in the repo currently,
# and replacing them with all files from those under the directory
# lab00_prototype
#
import getpass
import sys
import argparse
import os
import subprocess
PyGitHubLocs = ["./PyGithub"] # list of where to look for PyGithub
# "/Users/pconrad/github/github-acadwf-scripts/PyGithub"]
from github_acadwf import addPyGithubToPath
addPyGithubToPath()
from github import Github
from github import GithubException
from github_acadwf import pushFilesToRepo
parser = argparse.ArgumentParser(description='push files from labxx_prototype directory to labxx_* repos')
parser.add_argument('lab',metavar='labxx',
help="which lab (e.g. lab00, lab01, etc.)")
parser.add_argument('-f','--firstName',
help="if passed, only update labxx_FirstName",
default="")
parser.add_argument('-u','--githubUsername',
help="github username, default is current OS user",
default=getpass.getuser())
parser.add_argument('-s','--scratchDirName',
help="scratch directory to clone repos in while doing work",
default="./scratchRepos")
args = parser.parse_args()
pw = getpass.getpass()
g = Github(args.githubUsername, pw, user_agent="PyGithub")
org= g.get_organization("UCSB-CS56-S13")
pushFilesToRepo(g,org,args.lab,args.firstName,args.scratchDirName)