print messages even if the push is aborted

This commit is contained in:
Sebastian Sdorra
2013-07-27 17:18:38 +02:00
parent 0a98b646d5
commit eec1d32daf
2 changed files with 75 additions and 28 deletions

View File

@@ -42,6 +42,11 @@ baseUrl = os.environ['SCM_URL']
challenge = os.environ['SCM_CHALLENGE']
credentials = os.environ['SCM_CREDENTIALS']
def printMessages(ui, msgs):
for line in msgs:
if line.startswith("_e") or line.startswith("_n"):
ui.warn(line[2:]);
def callHookUrl(ui, repo, hooktype, node):
abort = True
try:
@@ -55,16 +60,14 @@ def callHookUrl(ui, repo, hooktype, node):
conn = opener.open(req)
if conn.code >= 200 and conn.code < 300:
ui.debug( "scm-hook " + hooktype + " success with status code " + str(conn.code) + "\n" )
for line in conn:
if line.startswith("_e") or line.startswith("_n"):
ui.warn(line[2:]);
printMessages(ui, conn)
abort = False
else:
ui.warn( "ERROR: scm-hook failed with error code " + str(conn.code) + "\n" )
except urllib2.URLError, e:
msg = e.read();
if len(msg) > 0:
ui.warn( "ERROR: " + msg)
printMessages(ui, msg.splitlines(True))
else:
ui.warn( "ERROR: scm-hook failed with error code " + str(e.getcode()) + "\n" )
except ValueError: