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
|
|
|
#
|
|
|
|
|
|
2011-07-24 13:36:19 +02:00
|
|
|
import os, urllib
|
2011-07-21 20:21:08 +02:00
|
|
|
|
|
|
|
|
baseUrl = "${url}"
|
2011-07-22 13:08:12 +02:00
|
|
|
challenge = "${challenge}"
|
2011-07-21 20:21:08 +02:00
|
|
|
|
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);
|
2011-07-22 12:25:42 +02:00
|
|
|
if conn.code == 200:
|
|
|
|
|
print( "scm-hook executed successfully" )
|
|
|
|
|
else:
|
|
|
|
|
print( "scm-hook failed" )
|