Mercurial > code > home > repos > reposync
comparison sync.py @ 10:460a2cf8b22b
hg push fails upon success
author | drewp@bigasterisk.com |
---|---|
date | Fri, 16 Jul 2021 00:30:53 -0700 |
parents | 2c4d383d464c |
children | 19a699305c29 |
comparison
equal
deleted
inserted
replaced
9:2c4d383d464c | 10:460a2cf8b22b |
---|---|
62 self.runGitCommand(['git', 'push', 'origin', 'master']) | 62 self.runGitCommand(['git', 'push', 'origin', 'master']) |
63 | 63 |
64 def hgToGithub(self): | 64 def hgToGithub(self): |
65 subprocess.check_call(['hg', 'bookmark', '-r', 'default', 'main'], | 65 subprocess.check_call(['hg', 'bookmark', '-r', 'default', 'main'], |
66 cwd=self.projRoot) | 66 cwd=self.projRoot) |
67 subprocess.check_call(['hg', 'push', | 67 push = subprocess.run(['hg', 'push', |
68 f'git+ssh://git@github.com/{self.gh.login}/{self.name}' | 68 f'git+ssh://git@github.com/{self.gh.login}/{self.name}' |
69 ], | 69 ], |
70 check=False, | |
71 capture_output=True, | |
70 cwd=self.projRoot, | 72 cwd=self.projRoot, |
71 env={'SSH_AUTH_SOCK': self.config['SSH_AUTH_SOCK']}) | 73 env={'SSH_AUTH_SOCK': self.config['SSH_AUTH_SOCK']}) |
74 if not push.stdout.endswith(b'no changes found\n'): | |
75 raise ValueError(f'hg push failed with {push.stdout!r}') | |
72 | 76 |
73 def getSshAuthSock(): | 77 def getSshAuthSock(): |
74 keychain = subprocess.check_output([ | 78 keychain = subprocess.check_output([ |
75 "keychain", "--noask", "--quiet", "--eval", "id_rsa"]).decode('ascii') | 79 "keychain", "--noask", "--quiet", "--eval", "id_rsa"]).decode('ascii') |
76 m = re.search(r'SSH_AUTH_SOCK=([^; \n]+)', keychain) | 80 m = re.search(r'SSH_AUTH_SOCK=([^; \n]+)', keychain) |