Project

General

Profile

HowTo setup automatic refresh of repositories in Redmine on commit » History » Version 4

Mischa The Evil, 2010-06-26 04:23
Replaced TOC.

1 1 Etienne Massip
h1. HowTo setup automatic refresh of repositories in Redmine on commit
2 4 Mischa The Evil
3
{{>toc}}
4 1 Etienne Massip
5 3 Etienne Massip
Since of version 0.9.0, you can use an HTTP submission, either GET or POST, to automatically refresh Redmine after you committed your modification in your repository.
6 1 Etienne Massip
7
Exemples:
8
9
* _/sys/fetch_changesets?key=<your service key>_ fetches changesets for all active projects
10
* _/sys/fetch_changesets?id=foo&key=<your service key>_ fetches changesets for project foo only
11
12
See #2925 for original feature request.
13
14
h2. Step 1 : configure Redmine to accept the request
15
16
Web service for repositories must by activated in the Administration menu and the generated key will have to be used by the caller in Step 2.
17
18
h2. Step 2 : setup a post-commit script on the SCM server
19
20
You have to setup a post-commit script which will call the previous URL.
21
22
h3. Subversion
23
24
Simply add a post-commit (or post-commit.cmd on a Windows system) script file in the hooks sub-directory which contains the HTTP request call :
25
26
<pre>
27
#!/bin/sh
28
29
curl http://<redmine url>/sys/fetch_changesets?key=<your service key>
30
</pre>
31
32
Or, on a Windows system (2 files) :
33
34
* post-commit.cmd :
35
<pre>
36 2 Etienne Massip
cscript "%~dp0refresh_redmine.vbs" //Nologo >> "%~dp0refresh_redmine.log" 2>&1
37 1 Etienne Massip
</pre>
38
39
* refresh_redmine.vbs :
40
<pre>
41
private const REDMINE_SERVICE_KEY = "<your service key>"
42
43
Call HTTPPost("http://<redmine url>/sys/fetch_changesets", "key=" & REDMINE_SERVICE_KEY)
44
45
Private Function HTTPPost(sUrl, sRequest)
46
  set oHTTP = CreateObject("Microsoft.XMLHTTP")
47
  oHTTP.open "POST", sUrl,false
48
  oHTTP.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
49
  oHTTP.setRequestHeader "Content-Length", Len(sRequest)
50
  oHTTP.send sRequest
51
  HTTPPost = oHTTP.responseText
52
End Function
53
</pre>