Category Archives: Redmine

Block commit to SVN when Redmine issue is not specified

Redmine allows to reference commits to issues by using keyword refs followed by # and number of the issue. If you want to block user commit to SVN without specifying Redmine issue you can use similar pre-commit hook on SVN. The hook is for Windows version.


REM *************************************************************
REM * this sets the arguments supplied by Subversion *
REM *************************************************************

REM *************************************************************
REM * define directory paths *
REM * you *must* add any paths for command line tools you plan *
REM * since SVN does not include the Windows %PATH% environment *
REM * variable for security reasons. *
REM * *
REM * DIR - the current hooks directory *
REM * PATH - a user set path of where executables are located *
REM * *
REM *************************************************************

REM *************************************************************
REM * make sure to add the path to the SendEmail executable *
REM *************************************************************

REM *************************************************************
REM * get comment search for "refs #" *
REM *************************************************************
svnlook log -t "%TXN%" "%REPOS%" | findstr /c:"refs #" > NUL
IF %errorlevel% NEQ 0 GOTO Error

GOTO Success

ECHO. 1>&2
ECHO Your commit has been blocked because you didn't 1>&2
ECHO specify Redmine issue with refs keyword. 1>&2
ECHO Please write a log message (eg. refs #123) and 1>&2
ECHO then try committing again. -- Thank you Roman 1>&2


Integrating Redmine with SVN

We are using Redmine in our company for issue tracking and SVN as a source control. As a client I use AnkhSVN primarily, because I am working inside Visual Studio most of the time. In this post I would like to show you plugins for AnkhSVN and TortoiseSVN which will help you assign your commits to specific issues in Redmine.
I will start with plugin for TortoiseSVN. Download the correct version 32bit or 64bit and install it. After that go to the TortoiseSVN Settings > Issue Tracker Integration. Specify working path of your source codes and Atom URL from Redmine. To get Atom URL go to the project page and click on the Issues tab. You can define a view which will select the correct issues for example only those which are open and assigned to you. On the bottom of the page there is a Atom link, copy the address and paste it to the Issue Tracker Configuration Window.

After the Issue Tracker Integration is configured go to the folder with your source codes and try to commit some changes. You will see new button in the Commit window called Redmine Issues. Clicking on it will display window with all issues which can be selected and added to the Commit Message.

There is a plugin for AnkhSVN available too. After you install it open some project in Visual Studio. Right click the solution in the Solution Explorer and open Issue Tracker Setup. On the dialog select the new installed connector. After that fill in your credentials. Issue Repository URL is the base URL of Redmine. Click Update button and select your default project. Also make sure that the REST API is enabled in the Redmine Administration.

That’s it! You are now able to click on the Issues button in the Pending Changes window and select active issues.