pygitx

Python script to download repos from github. It checked localfiles and skips downloading any repos that currently exsist. Perform a git pull for each repo that exsists

In [50]:
from github import Github
In [51]:
import os
import getpass
from git import *
import git
In [52]:
p = open('/home/wcmckee/ps.txt', 'r')
In [53]:
#str(p.read())
In [54]:
pred = str(p.read())
In [55]:
g = Github('wcmckee', 'test')
In [56]:
grepo = g.search_users('wcmckee')                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   
In [57]:
for gre in grepo:
    print gre.repos_url
https://api.github.com/users/wcmckee/repos
In [58]:
print gre.email
will@artcontrol.me
In [59]:
grrep = gre.get_repos()
In [60]:
replist =  list(grrep)
In [61]:
repolisx = []
repocom = []
In [62]:
for repoz in replist:
    print repoz.name
    repolisx.append(repoz.name)
    print repoz.size
    print repoz.updated_at
  #  repocom.append(repoz.get_commits)
4chan-API
239
2013-09-24 10:20:16
adypy
684
2014-06-09 04:52:12
anim_framework
260
2014-05-07 21:25:20
art-lastfm
636
2014-01-31 01:21:57
artcontrol-api
2012
2014-09-26 09:58:43
AsylumJamCrushGame
146482
2013-10-12 18:40:22
autopaintpy123
6176
2014-02-07 07:55:31
bacongamejam05
64
2013-12-18 14:12:00
battlenet
60
2013-10-16 14:06:51
bbc2wp
148
2014-09-21 18:35:09
bgj05-hungry
11316
2014-03-23 21:09:43
BirdCage
43209
2014-04-13 21:05:50
brobeur-static
2896
2014-05-05 02:02:45
brobeur-web
1798
2014-04-29 08:46:54
BroBeurFishingDream
5678
2014-02-16 19:19:16
broLove
108
2014-04-22 16:53:58
clint
848
2013-08-30 11:26:48
cobal.eportfolio
1361
2013-10-10 06:10:22
compohub
5030
2014-05-03 11:06:39
DailyProgBot
74
2013-08-30 11:26:48
DeltaBot
170
2013-08-30 11:26:48
dockerfiles
10055
2014-07-12 19:51:01
flask
9159
2013-12-18 05:05:44
flask-ghpages-example
76
2014-07-02 00:14:33
ggj14
50697
2014-01-26 02:48:08
hackage-server
5852
2013-09-30 07:50:04
hamiltoncomputerclub.org.nz
536
2014-05-13 00:12:55
haskell-learn
132
2014-02-05 10:22:41
HTML5-Tiny
10442
2014-05-22 03:16:18
html5lib-python
6911
2013-10-15 05:55:33
iamagamer
6755
2014-05-29 01:06:20
ihaskell-notebook
466
2013-10-01 22:09:52
imgur-python
220
2014-10-07 18:14:23
intercity
716
2014-05-12 12:56:13
intro_programming
8184
2013-12-06 05:32:29
ipython
296
2013-09-14 13:21:02
ipython-docker
4172
2014-06-10 00:29:33
ipython-hydra
70
2014-07-11 17:19:35
LD48-Skins
152
2013-12-19 20:47:10
marshmallow
422
2013-11-17 12:37:13
massive-wright
112
2013-10-29 06:30:14
Minecraft
17273
2014-05-06 19:19:03
miniprojects
87
2013-08-30 11:26:46
molyjam2013
27370
2013-08-30 11:26:46
niketa
160
2014-06-27 03:18:50
opencompetencies
778
2013-12-13 00:12:34
openfaux-server
209
2013-12-18 10:19:54
ouya-unity-plugin
26723
2014-09-10 19:08:05
paintingautopy
104
2014-02-04 12:01:36
pithos
880
2013-10-06 12:06:46
prodo-game
5208
2014-05-05 21:07:36
Projects
1712
2013-08-30 11:26:48
puphpet
11404
2014-07-11 03:36:52
pyatakl
1928
2014-06-29 01:24:11
pybackupz
196
2014-01-30 16:55:31
pyladies
5186
2014-04-26 22:23:20
pymel
175471
2013-11-17 11:45:49
python-guide
538
2013-08-30 11:26:45
python-pandora
120
2013-08-30 11:26:48
python-patterns
90
2013-08-30 11:26:47
pytm
64
2013-09-10 03:06:24
pyunderdog
188
2014-02-02 14:35:35
pywp-post
212
2014-06-02 07:16:53
raspi
128
2014-01-28 08:29:32
RasPiWrite
198
2014-01-20 18:31:17
RedditPress
356
2014-04-22 16:53:58
reddit_bot
114
2013-08-30 11:26:48
redtube
215
2014-05-07 20:52:47
render-useful
340
2014-11-14 08:56:35
RPIO
2471
2014-01-28 10:28:53
selfspy
235
2014-04-21 10:06:55
SketchDaily-GestureDrawing
5077
2014-05-22 19:15:06
skins
220
2014-02-15 12:56:01
SortPictures
140
2014-02-12 13:51:53
SoundWall
1958
2014-05-03 10:38:30
SuburbNightmare
64368
2014-04-17 06:02:40
te-whare-o-te-ata
464
2014-06-24 08:34:54
TPB
387
2013-10-04 11:50:53
Triger
18723
2014-02-18 16:10:27
tweepy
727
2013-08-30 11:26:47
UnityLuaIntegration
246
2013-08-30 11:26:47
vagrantboxes-heroku
2447
2014-07-11 13:02:20
vIPer
855
2014-05-11 06:17:26
wcmckee
1500
2014-12-19 10:27:44
wcmckee-notebook
29716
2014-09-02 11:51:52
wcmckee.com
584
2014-05-13 00:30:55
wcmckee.github.io
140
2014-04-27 12:28:03
wcmStringPY
1600
2014-02-02 17:24:08
wirepil
2152
2014-02-14 10:30:42
xboxdrv
64
2013-10-02 11:22:40
In [63]:
#for repz in repocom:
#    print repoz.ssh_url
In [64]:
for repoit in repolisx:
    print repoit
4chan-API
adypy
anim_framework
art-lastfm
artcontrol-api
AsylumJamCrushGame
autopaintpy123
bacongamejam05
battlenet
bbc2wp
bgj05-hungry
BirdCage
brobeur-static
brobeur-web
BroBeurFishingDream
broLove
clint
cobal.eportfolio
compohub
DailyProgBot
DeltaBot
dockerfiles
flask
flask-ghpages-example
ggj14
hackage-server
hamiltoncomputerclub.org.nz
haskell-learn
HTML5-Tiny
html5lib-python
iamagamer
ihaskell-notebook
imgur-python
intercity
intro_programming
ipython
ipython-docker
ipython-hydra
LD48-Skins
marshmallow
massive-wright
Minecraft
miniprojects
molyjam2013
niketa
opencompetencies
openfaux-server
ouya-unity-plugin
paintingautopy
pithos
prodo-game
Projects
puphpet
pyatakl
pybackupz
pyladies
pymel
python-guide
python-pandora
python-patterns
pytm
pyunderdog
pywp-post
raspi
RasPiWrite
RedditPress
reddit_bot
redtube
render-useful
RPIO
selfspy
SketchDaily-GestureDrawing
skins
SortPictures
SoundWall
SuburbNightmare
te-whare-o-te-ata
TPB
Triger
tweepy
UnityLuaIntegration
vagrantboxes-heroku
vIPer
wcmckee
wcmckee-notebook
wcmckee.com
wcmckee.github.io
wcmStringPY
wirepil
xboxdrv
In [65]:
repolisx
Out[65]:
[u'4chan-API',
 u'adypy',
 u'anim_framework',
 u'art-lastfm',
 u'artcontrol-api',
 u'AsylumJamCrushGame',
 u'autopaintpy123',
 u'bacongamejam05',
 u'battlenet',
 u'bbc2wp',
 u'bgj05-hungry',
 u'BirdCage',
 u'brobeur-static',
 u'brobeur-web',
 u'BroBeurFishingDream',
 u'broLove',
 u'clint',
 u'cobal.eportfolio',
 u'compohub',
 u'DailyProgBot',
 u'DeltaBot',
 u'dockerfiles',
 u'flask',
 u'flask-ghpages-example',
 u'ggj14',
 u'hackage-server',
 u'hamiltoncomputerclub.org.nz',
 u'haskell-learn',
 u'HTML5-Tiny',
 u'html5lib-python',
 u'iamagamer',
 u'ihaskell-notebook',
 u'imgur-python',
 u'intercity',
 u'intro_programming',
 u'ipython',
 u'ipython-docker',
 u'ipython-hydra',
 u'LD48-Skins',
 u'marshmallow',
 u'massive-wright',
 u'Minecraft',
 u'miniprojects',
 u'molyjam2013',
 u'niketa',
 u'opencompetencies',
 u'openfaux-server',
 u'ouya-unity-plugin',
 u'paintingautopy',
 u'pithos',
 u'prodo-game',
 u'Projects',
 u'puphpet',
 u'pyatakl',
 u'pybackupz',
 u'pyladies',
 u'pymel',
 u'python-guide',
 u'python-pandora',
 u'python-patterns',
 u'pytm',
 u'pyunderdog',
 u'pywp-post',
 u'raspi',
 u'RasPiWrite',
 u'RedditPress',
 u'reddit_bot',
 u'redtube',
 u'render-useful',
 u'RPIO',
 u'selfspy',
 u'SketchDaily-GestureDrawing',
 u'skins',
 u'SortPictures',
 u'SoundWall',
 u'SuburbNightmare',
 u'te-whare-o-te-ata',
 u'TPB',
 u'Triger',
 u'tweepy',
 u'UnityLuaIntegration',
 u'vagrantboxes-heroku',
 u'vIPer',
 u'wcmckee',
 u'wcmckee-notebook',
 u'wcmckee.com',
 u'wcmckee.github.io',
 u'wcmStringPY',
 u'wirepil',
 u'xboxdrv']
In [69]:
homlaz = ('/home/wcmckee/pygitx')
In [71]:
os.chdir(homlaz)
In [72]:
#opgitp = open('gitp.txt', 'r')
In [73]:
#_LOKDD
In [74]:
#rpa
In [75]:
dirlis = os.listdir(homlaz)
In [76]:
dirme = set(dirlis) - set(repolisx)
In [77]:
dirout = set(repolisx) - set(dirlis)
In [78]:
for dirz in dirout:
    print dirz
RasPiWrite
wcmckee.github.io
ggj14
flask
4chan-API
BroBeurFishingDream
art-lastfm
pywp-post
flask-ghpages-example
TPB
autopaintpy123
broLove
wcmckee-notebook
wirepil
dockerfiles
SketchDaily-GestureDrawing
SoundWall
te-whare-o-te-ata
SortPictures
cobal.eportfolio
intro_programming
python-guide
pyunderdog
skins
ouya-unity-plugin
adypy
pybackupz
selfspy
niketa
Projects
wcmckee
bgj05-hungry
BirdCage
iamagamer
ipython
redtube
imgur-python
paintingautopy
brobeur-web
molyjam2013
prodo-game
reddit_bot
DeltaBot
marshmallow
ipython-hydra
compohub
pyladies
python-patterns
hackage-server
pithos
bbc2wp
vIPer
Triger
RedditPress
tweepy
pytm
anim_framework
HTML5-Tiny
artcontrol-api
miniprojects
SuburbNightmare
raspi
UnityLuaIntegration
ipython-docker
intercity
puphpet
DailyProgBot
pymel
brobeur-static
clint
bacongamejam05
wcmckee.com
wcmStringPY
RPIO
html5lib-python
render-useful
vagrantboxes-heroku
python-pandora
LD48-Skins
hamiltoncomputerclub.org.nz
battlenet
haskell-learn
Minecraft
openfaux-server
AsylumJamCrushGame
xboxdrv
massive-wright
ihaskell-notebook
opencompetencies
pyatakl
In [79]:
dirme
Out[79]:
set()
In [80]:
merglis = set(dirlis) & set(repolisx)
In [81]:
merglis   
Out[81]:
set()
In [ ]:
for repoit in repolisx:
    print repoit
    os.system('git clone https://github.com/wcmckee/' + repoit)
    #git.Git().clone('https://github.com/wcmckee/' + repoit)
4chan-API
adypy
anim_framework
art-lastfm
artcontrol-api
AsylumJamCrushGame
autopaintpy123
bacongamejam05
battlenet
bbc2wp
bgj05-hungry
BirdCage
brobeur-static
brobeur-web
BroBeurFishingDream
broLove
clint
cobal.eportfolio
compohub
DailyProgBot
DeltaBot
dockerfiles
flask
flask-ghpages-example
ggj14
In [83]:
wcmrepo = git.repository('/home/wcmckee/wcmkee')
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-83-fe34f7ddb807> in <module>()
----> 1 wcmrepo = git.repository('/home/wcmckee/wcmkee')

TypeError: 'module' object is not callable
In [84]:
help('git')
Help on package git:

NAME
    git - # -*- coding: utf-8 -*- ex:set ts=4 sw=4 et:

FILE
    /usr/local/lib/python2.7/dist-packages/git/__init__.py

PACKAGE CONTENTS
    config
    gitbinary
    misc
    objects
    repository


In [84]:
 
In [85]:
import git
In [86]:
from git import *
repo = Repo("/Users/mtrier/Development/git-python")
---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)
<ipython-input-86-497077d73790> in <module>()
      1 from git import *
----> 2 repo = Repo("/Users/mtrier/Development/git-python")

NameError: name 'Repo' is not defined
In [87]:
git.Repository.clone('https://github.com/wcmckee/BeOk')
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-87-66ad7af6c29e> in <module>()
----> 1 git.Repository.clone('https://github.com/wcmckee/BeOk')

TypeError: unbound method clone() must be called with Repository instance as first argument (got str instance instead)
In [88]:
git.repository.Repository.clone()
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-88-4495727d2e19> in <module>()
----> 1 git.repository.Repository.clone()

TypeError: unbound method clone() must be called with Repository instance as first argument (got nothing instead)
In [89]:
(git.objects)
Out[89]:
<module 'git.objects' from '/usr/local/lib/python2.7/dist-packages/git/objects.pyc'>
In [ ]:
 

Comments

Comments powered by Disqus