gitwcmpull
Dealing with git repos. Doing pulls to all repos.
In [39]:
import git
import os
import github
import getpass
In [10]:
from github import Github
In [11]:
opz = open('/home/wcmckee/gpas.txt', 'r')
gpasz = opz.read()
In [ ]:
gusr = raw_input('Enter username: ')
gpas = getpass.getpass('Enter Password: ')
In [18]:
g = Github(gusr, gpas)
In [25]:
#for grza in g.get_organization(
In [27]:
gilis = []
In [29]:
for grp in g.get_user().get_repos():
gilis.append(grp.name)
In [35]:
#list of repos missing local - perform git pull
list(set(gilis) - set(lidirz))
Out[35]:
In [ ]:
In [2]:
#Test if folder is there and that the origin pull is on github.
#If it's not on github, skip.
#Two Lists. One is list of repos from github. Other is list of
#local folder repos.
#Compare items in each list.
#lis1 is github
#lis2 is local
#if 'ipython' is on lis1 but not two, then it performs
#git clone on github repo
#
#If item is on local but not on github
#check organision
#skip the git pull.
In [23]:
lidirz = os.listdir('/media/removable/USB Drive/wcmckee-git')
In [37]:
#for lid in lidirz:
# print lid
In [38]:
#for grp in g.get_user().get_repos():
# print grp.name
In [ ]:
In [ ]:
In [6]:
lismed = os.listdir('/media/removable/USB Drive/wcmckee-git')
In [36]:
#List of repos missing from github
list(set(lidirz) - set(gilis))
Out[36]:
In [33]:
#Repos that are both on github and local.
list(set(gilis).intersection(set(lidirz)))
Out[33]:
In [7]:
#os.chdir('/media/removable/USB Drive/wcmckee-git/' + lism)
In [9]:
#os.system('git pull')
In [ ]:
for lism in lismed:
print lism
os.chdir('/media/removable/USB Drive/wcmckee-git/' + lism)
os.system('git pull')
In [ ]: