Files
SCM-Manager/scm-plugins/scm-hg-plugin/src/main/resources/sonia/scm/hghook.py

22 lines
527 B
Python
Raw Normal View History

2011-07-21 20:37:12 +02:00
#
# registration .hg/hgrc:
#
# [hooks]
2011-07-21 21:24:27 +02:00
# changegroup.scm = python:scmhooks.callback
2011-07-21 20:37:12 +02:00
#
import os, urllib
baseUrl = "${url}"
2011-07-22 13:08:12 +02:00
challenge = "${challenge}"
2011-07-21 20:37:12 +02:00
def callback(ui, repo, hooktype, node=None, source=None, **kwargs):
2011-07-21 21:24:27 +02:00
if node != None:
2011-07-22 13:08:12 +02:00
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:
print( "scm-hook failed" )