2011-07-21 20:21:08 +02:00
|
|
|
#!/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
|
|
|
#
|
|
|
|
|
|
2011-07-21 20:21:08 +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);
|
|
|
|
|
# todo validate (if conn.code == 200:)
|