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

29 lines
638 B
Python
Raw Normal View History

#!/usr/bin/env ${python}
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, sys, urllib
pythonPath = "${path}"
if len(pythonPath) > 0:
pathParts = pythonPath.split(os.pathsep)
for i in range(len(pathParts)):
sys.path.insert(i, pathParts[i])
baseUrl = "${url}"
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:
url = baseUrl + os.path.basename(repo.root) + "/" + hooktype + "?node=" + node
conn = urllib.urlopen(url);
if conn.code == 200:
print( "scm-hook executed successfully" )
else:
print( "scm-hook failed" )