changeset 10:460a2cf8b22b

hg push fails upon success
author drewp@bigasterisk.com
date Fri, 16 Jul 2021 00:30:53 -0700
parents 2c4d383d464c
children 19a699305c29
files sync.py
diffstat 1 files changed, 5 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/sync.py	Fri Jul 16 00:19:01 2021 -0700
+++ b/sync.py	Fri Jul 16 00:30:53 2021 -0700
@@ -64,11 +64,15 @@
     def hgToGithub(self):
         subprocess.check_call(['hg', 'bookmark', '-r', 'default', 'main'],
                               cwd=self.projRoot)
-        subprocess.check_call(['hg', 'push',
+        push = subprocess.run(['hg', 'push',
                                f'git+ssh://git@github.com/{self.gh.login}/{self.name}'
                                ],
+                              check=False,
+                              capture_output=True,
                               cwd=self.projRoot,
                               env={'SSH_AUTH_SOCK': self.config['SSH_AUTH_SOCK']})
+        if not push.stdout.endswith(b'no changes found\n'):
+            raise ValueError(f'hg push failed with {push.stdout!r}')
 
 def getSshAuthSock():
     keychain = subprocess.check_output([