comparison sync.py @ 8:cc3321b8adc1

fix silly case
author drewp@bigasterisk.com
date Fri, 16 Jul 2021 00:18:34 -0700
parents 7f479502a8ab
children 2c4d383d464c
comparison
equal deleted inserted replaced
7:7f479502a8ab 8:cc3321b8adc1
43 }, **callKw) 43 }, **callKw)
44 except: 44 except:
45 log.error("in %s" % self.gitDir()) 45 log.error("in %s" % self.gitDir())
46 raise 46 raise
47 47
48 def makeGitHubRepo(self): 48 def makeGithubRepo(self):
49 try: 49 try:
50 self.gh.create_repo(self.name) 50 self.gh.create_repo(self.name)
51 except GithubException as e: 51 except GithubException as e:
52 print('exists') 52 print('exists')
53 assert e.data['errors'][0]['message'].startswith('name already exists'), (e, self.name) 53 assert e.data['errors'][0]['message'].startswith('name already exists'), (e, self.name)
54 return 54 return
55 self.runGitCommand(['git', 'remote', 'add', 'origin', 55 self.runGitCommand(['git', 'remote', 'add', 'origin',
56 'git@github.com:%s/%s.git' % (self.gh.login, 56 'git@github.com:%s/%s.git' % (self.gh.login,
57 self.name)]) 57 self.name)])
58 58
59 def pushToGitHub(self): 59 def pushToGithub(self):
60 self.runGitCommand(['git', 'push', 'origin', 'master']) 60 self.runGitCommand(['git', 'push', 'origin', 'master'])
61 61
62 def hgToGitHub(self): 62 def hgToGithub(self):
63 subprocess.check_call(['hg', 'bookmark', '-r', 'default', 'main'], 63 subprocess.check_call(['hg', 'bookmark', '-r', 'default', 'main'],
64 cwd=self.projRoot) 64 cwd=self.projRoot)
65 subprocess.check_call(['hg', 'push', 65 subprocess.check_call(['hg', 'push',
66 f'git+ssh://git@github.com/{self.gh.login}/{self.name}' 66 f'git+ssh://git@github.com/{self.gh.login}/{self.name}'
67 ], 67 ],
97 if p.darcsTime() < time.time() - 86400*config['tooOldDays']: 97 if p.darcsTime() < time.time() - 86400*config['tooOldDays']:
98 continue 98 continue
99 99
100 log.info("syncing %s", proj) 100 log.info("syncing %s", proj)
101 p.syncToLocalGit() 101 p.syncToLocalGit()
102 p.makeGitHubRepo() 102 p.makeGithubRepo()
103 p.pushToGitHub() 103 p.pushToGithub()
104 except Exception as e: 104 except Exception as e:
105 traceback.print_exc() 105 traceback.print_exc()