added a challenge for mercurial hooks

This commit is contained in:
Sebastian Sdorra
2011-07-22 13:08:12 +02:00
parent 21013a967f
commit 6b678b502a
5 changed files with 135 additions and 23 deletions

View File

@@ -17,11 +17,13 @@ if len(pythonPath) > 0:
sys.path.insert(i, pathParts[i])
baseUrl = "${url}"
challenge = "${challenge}"
def callback(ui, repo, hooktype, node=None, source=None, **kwargs):
if node != None:
url = baseUrl + os.path.basename(repo.root) + "/" + hooktype + "?node=" + node
conn = urllib.urlopen(url);
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: