mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-14 09:25:43 +01:00
pass nodeid to mercurial rest hook
This commit is contained in:
@@ -43,6 +43,7 @@ import org.slf4j.LoggerFactory;
|
|||||||
import javax.ws.rs.GET;
|
import javax.ws.rs.GET;
|
||||||
import javax.ws.rs.Path;
|
import javax.ws.rs.Path;
|
||||||
import javax.ws.rs.PathParam;
|
import javax.ws.rs.PathParam;
|
||||||
|
import javax.ws.rs.QueryParam;
|
||||||
import javax.ws.rs.core.Response;
|
import javax.ws.rs.core.Response;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -66,14 +67,16 @@ public class HgHookCallback
|
|||||||
*
|
*
|
||||||
* @param repositoryName
|
* @param repositoryName
|
||||||
* @param type
|
* @param type
|
||||||
|
* @param node
|
||||||
*
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@GET
|
@GET
|
||||||
public Response hookCallback(@PathParam("repository") String repositoryName,
|
public Response hookCallback(@PathParam("repository") String repositoryName,
|
||||||
@PathParam("type") String type)
|
@PathParam("type") String type,
|
||||||
|
@QueryParam("node") String node)
|
||||||
{
|
{
|
||||||
logger.warn("retrive hg hook {}", type);
|
logger.warn("retrive hg hook {}, node {}", type, node);
|
||||||
|
|
||||||
return Response.ok().build();
|
return Response.ok().build();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
# registration .hg/hgrc:
|
# registration .hg/hgrc:
|
||||||
#
|
#
|
||||||
# [hooks]
|
# [hooks]
|
||||||
# incoming = python:scmhooks.callback
|
# changegroup.scm = python:scmhooks.callback
|
||||||
#
|
#
|
||||||
|
|
||||||
import os, sys, urllib
|
import os, sys, urllib
|
||||||
@@ -19,6 +19,7 @@ if len(pythonPath) > 0:
|
|||||||
baseUrl = "${url}"
|
baseUrl = "${url}"
|
||||||
|
|
||||||
def callback(ui, repo, hooktype, node=None, source=None, **kwargs):
|
def callback(ui, repo, hooktype, node=None, source=None, **kwargs):
|
||||||
url = baseUrl + os.path.basename(repo.root) + "/" + hooktype
|
if node != None:
|
||||||
|
url = baseUrl + os.path.basename(repo.root) + "/" + hooktype + "?node=" + node
|
||||||
conn = urllib.urlopen(url);
|
conn = urllib.urlopen(url);
|
||||||
# todo validate (if conn.code == 200:)
|
# todo validate (if conn.code == 200:)
|
||||||
|
|||||||
Reference in New Issue
Block a user