Commits

Mikhail Korobov committed 7790527

do not abort on hg push error

Comments (0)

Files changed (1)

fab_deploy/vcs/hg.py

 # coding: utf-8
-from fabric.api import run, local, env
+from fabric.api import run, local, env, settings, abort
+from fabric.contrib.console import confirm
 from taskset import TaskSet, task_method
 
 from fab_deploy.utils import upload_config_template
 
     @task_method
     def push(self, branch=None):
-        local('hg push ssh://%s/src/%s/' % (env.hosts[0], env.conf.INSTANCE_NAME))
+        with settings(warn_only=True):
+            res = local('hg push ssh://%s/src/%s/ --new-branch' % (env.hosts[0], env.conf.INSTANCE_NAME))
+            if res.failed:
+                if not confirm("Error occured during push. Continue anyway?", default=False):
+                    abort("Aborting.")
 
     @task_method
     def configure(self):