public
Description: Python interface for talking to the github API
Clone URL: git://github.com/dustin/py-github.git
Repair the older format syncs so mirror is set up properly.
dustin (author)
Tue May 13 01:55:01 -0700 2008
commit  b33933986e98298edb7a18c4bb381c54830fe12e
tree    8f7ac9c8251c6013abd013c21108cf75ca680875
parent  383cd033d217539d9f28e4ccd7d123a785050d1d
...
11
12
13
 
 
 
 
 
 
 
 
 
 
 
 
 
14
15
16
17
18
19
20
 
 
21
22
23
...
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
0
@@ -11,13 +11,26 @@ import subprocess
0
 
0
 import github
0
 
0
+def check_for_old_format(path, url):
0
+ p=subprocess.Popen(['git', '--git-dir=' + path, 'config',
0
+ 'remote.origin.fetch'], stdout=subprocess.PIPE)
0
+ stdout, stderr=p.communicate()
0
+ if stdout.strip() != '+refs/*:refs/*':
0
+ print "Not properly configured for mirroring, repairing."
0
+ subprocess.call(['git', '--git-dir=' + path, 'remote', 'rm', 'origin'])
0
+ add_mirror(path, url)
0
+
0
+def add_mirror(path, url):
0
+ subprocess.call(['git', '--git-dir=' + path, 'remote', 'add', '--mirror',
0
+ 'origin', url])
0
+
0
 def sync(path, url, repo_name):
0
     p=os.path.join(path, repo_name) + ".git"
0
     print "Syncing %s -> %s" % (repo_name, p)
0
     if not os.path.exists(p):
0
         subprocess.call(['git', 'clone', '--bare', url, p])
0
- subprocess.call(['git', '--git-dir=' + p, 'remote', 'add', '--mirror',
0
- 'origin', url])
0
+ add_mirror(p, url)
0
+ check_for_old_format(p, url)
0
     subprocess.call(['git', '--git-dir=' + p, 'fetch', '-f'])
0
 
0
 def sync_user_repo(path, user, repo):

Comments

    No one has commented yet.