# HG changeset patch # User drewp@bigasterisk.com # Date 1626506067 25200 # Node ID f83b7426b97cd1ae179a95660082266274750c1d # Parent e6ab74a372910ddab06b8e09d94cc85473a7373c fix makeGithubRepo; use ssh_url for almost no benefit diff -r e6ab74a37291 -r f83b7426b97c sync.py --- a/sync.py Fri Jul 16 00:41:23 2021 -0700 +++ b/sync.py Sat Jul 17 00:14:27 2021 -0700 @@ -12,7 +12,7 @@ self.config = json.load(open(Path(__file__).parent / "config.json")) self.config['SSH_AUTH_SOCK'] = getSshAuthSock() - self.gh = Github(self.config['githubToken']).get_user() + self.gh = Github(self.config['githubToken']) self.projRoot = projRoot self.name = projRoot.name @@ -50,22 +50,20 @@ def makeGithubRepo(self): try: - self.gh.create_repo(self.name) + self.gh.get_user().create_repo(self.name) except GithubException as e: assert e.data['errors'][0]['message'].startswith('name already exists'), (e, self.name) return - self.runGitCommand(['git', 'remote', 'add', 'origin', - 'git@github.com:%s/%s.git' % (self.gh.login, - self.name)]) - + def pushToGithub(self): self.runGitCommand(['git', 'push', 'origin', 'master']) def hgToGithub(self): subprocess.check_call(['hg', 'bookmark', '-r', 'default', 'main'], cwd=self.projRoot) + repo = self.gh.get_user().get_repo(self.name) push = subprocess.run(['hg', 'push', - f'git+ssh://git@github.com/{self.gh.login}/{self.name}' + f'git+ssh://'+repo.ssh_url.replace(':', '/'), ], check=False, capture_output=True,