Configure Source Control Management
The first thing you'll want to do is configure Source Control Management in OnTime. Right click on any of your projects (although I would suggest you do this from the root project) and select Manage Source Control. OnTime will then present you with the following screen:
- Set Subversion as your source control plug-in.
- Command Line Client -- TortoiseSVN will not cut it. If you don't have a command line client installed (VisualSVN is fine), any of the ones here will work. I have VisualSVN but I verified that the CollabNet one works as well. Enter the path to svn.exe.
- Server URL -- This is the same value you use for your source repository. It's usually something like svn://host/repositoryName.
- Username -- Your username in Subversion.
- Password -- Your password for Subversion
- Working Copy Location -- Location of the repository on your hard drive.
- Timeout Value -- This one is important. It defaults to 15 seconds. If you have a slow Internet connection or you're working with a large repository you will likely need more time. If you get a null reference exception that isn't handled, increasing this value may resolve your problem.
Go to the subversion properties on the root folder in your repository and enter the following values:
bugtraq:number false is actually important for the way I'm getting around a specific design choice with OnTime. All of the primary keys for tasks, defects, incidents, features seem to be shared across ticket types. In order to properly navigate to the ticket, we're going to adopt a naming convention to tell TortoiseLinker.asp what type of issue we're dealing with so it will know where to send us.
When you enter the bug id on a code checkin, prefix the issue with a d for defect, t for task, and an f for feature.
Create TortoiseLinker.asp
Now that we've got our subversion variables setup, the only thing left is placing a script in your OnTime web app that will direct the user to the appropriate ticket.
- Create a file called TortoiseLinker.asp and put it in the root directory of your OnTime web application.
<%
Dim urlid
Dim ticketType
'Set both of these values = to the bug id coming across
ticketType = request("id")
urlid = request("id")
'Grab the first character. (d = defect, t = task, f = feature)
ticketType = left(ticketType, 1)
Dim ticketTypeAsciiNumber
'Get the ascii value of the first character
ticketTypeAsciiNumber = Asc(UCase(ticketType))
'See if the ascii value of the first character equals d, f, or t
if(ticketTypeAsciiNumber = 68 or ticketTypeAsciiNumber = 70 or ticketTypeAsciiNumber = 84) Then
'Set the url to the actual bug number, ripping off the first character that indicates the issue type
urlid = right(request("id"), len(request("id"))- 1)
'defect
if(ticketTypeAsciiNumber = 68) then
response.redirect("/OnTime2008Web/Defects/ViewDefect.aspx?DefectId=" + urlid)
'feature
elseif(ticketTypeAsciiNumber = 70) then
response.redirect("/OnTime2008Web/Features/ViewFeature.aspx?FeatureId=" + urlid)
'task
elseif(ticketTypeAsciiNumber = 84) then
response.redirect("/OnTime2008Web/Tasks/ViewTask.aspx?TaskId=" + urlid)
'should never really get here
else
response.redirect("/OnTime2008Web/Defects/ViewDefect.aspx?DefectId=" + urlid)
end if
'the first number is something we don't support, just send them on to the defect page and hope for the best.
else
response.redirect("/OnTime2008Web/Defects/ViewDefect.aspx?DefectId=" + urlid)
end if
response.end
%>
Done! Now you can manually link files in OnTime to issues and you'll get links in the log messages from subversion that will take you directly to the issue in the web app.
One final note: I had to enable asp page processing on our server to get this to work. Directions on how to do that can be found here.