From be674af7419bae96943147000fb10ecc99109874 Mon Sep 17 00:00:00 2001 From: Sebastian Sdorra Date: Wed, 5 Oct 2011 18:54:39 +0200 Subject: [PATCH] abort mercurial transaction if pre receive hook fails --- .../scm-hg-plugin/src/main/resources/sonia/scm/hghook.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/scm-plugins/scm-hg-plugin/src/main/resources/sonia/scm/hghook.py b/scm-plugins/scm-hg-plugin/src/main/resources/sonia/scm/hghook.py index 42771cd599..20b24ab658 100644 --- a/scm-plugins/scm-hg-plugin/src/main/resources/sonia/scm/hghook.py +++ b/scm-plugins/scm-hg-plugin/src/main/resources/sonia/scm/hghook.py @@ -46,7 +46,6 @@ def callback(ui, repo, hooktype, node=None, source=None, **kwargs): url = baseUrl + os.path.basename(repo.root) + "/" + hooktype data = urllib.urlencode({'node': node, 'challenge': challenge}) conn = urllib.urlopen(url, data); - if conn.code == 200: - print( "scm-hook executed successfully" ) - else: + if conn.code >= 400: print( "scm-hook failed with error code " + str(conn.code) ) + sys.exit(1)