Configure Source Code Repository Integration

Mercurial (HG)
Subversion (SVN)

BugNET supports integration with version/ source control repositories.

After BugNET is configured to use version control integration each commit message to the repository will be examined for an issue Id.

If an issue Id is found, a comment is logged on that issue with the commit message, revision, date ,time and user who committed the change to the repository.

This integration also adds a new tab to the top menu of your BugNET installation which allows you to browse your source code repository directly from within BugNET.

Mercurial (HG)

The following describes the configuration of the Mercurial ChangeGroup Hook

Configuring your repositories

For each repository you want the hook to run you will need to copy the following lines to the file
.hg\hgrc in the repository.
  • Change the PATH_TO_EXE to the location of the hooks executable.
  • Change the localhost to the url/domain of your BugNet site.
  • Change the HOOK to an appropriate hook, see the Which hook should I use? section below

HOOK.BugNet = "PATH_TO_EXE\BugNET.MercurialChangeGroupHook.exe"

issue.regex = \[?([A-Za-z]{1,50}-(\d+))\]? = http://localhost/Issues/IssueDetail.aspx?id={2}

Note that the .BugNet is an arbitrary identifier for the hook which allows multiple hooks to be run on the same action, see the Mercurial Hooks documentation for more information.

Which hook should I use?

Depending on your developer setup and workflow you will need to configure different hooks. The most common hooks are as follows:

Hook Runs Usage Scenario
changegroup When a changegroup is brought into a repository, runs once regardless of how many changesets are involved Best used for central repositories, means the hook will run whenever anyone pushes to this repository or works with the repository directly and pulls in changes from other repositories. If you host this with a service like BitBucket or CodePlex where you cannot install your own hooks you will need to use an alternative hook on your local repository instead. You can also use this hook if you regularly pull changes into your local repository for integration before pushing them to another repository.
outgoing When a group of change sets is pushed out of the repository, runs once for each change set Typically this happens when you do a hg push, useful if you push to another repository on which you cannot install the hook
commit When a changeset is committed to the repository Runs when you do a hg commit or other action that creates a commit (e.g. hg tag), useful if you do a lot of commits locally and want BugNet to track your revisions prior to your pushing them to your upstream repository.

You can find the complete list of Mercurial hooks here

Configuring the Hook

Configure the BugNET.MercurialChangeGroupHook.exe.config appSettings properties for your environment.

BugNetUsername When not using Windows Authentication set this to a BugNET username that has permissions to logon to BugNET.
BugNetPassword When not using Windows Authentication set this to the password for the BugNetUsername entered.
BugNetServicesUrl This is the fully qualified Url to the web services, This would be the same Url as in the Application Settings - Basic - Default Url along with WebServices/BugNetServices.asmx as the path part. i.e. http://localhost/WebServices/BugNetServices.asmx
BugNetWindowsAuthentication True when using Windows Authentication for BugNET, otherwise False.

Configuration of logging

By default the Hook logs to a local file in the same folder as the exe. However this can be changed to log
to BugNET by doing the following.

Copy the <log4net> section from your BugNET log4net.config file over the <log4net> section in the
BugNET.MercurialChangeGroupHook.exe.config file. Depending on your environment you may have to configure the
connection string to use a username/password. The reason for this is the user account who commits must have access to
the BugNET database as well.

Note about Windows Authentication

Depending on how your environment is configured some things to note.

When a user synchronizes with your remote repository the users user/password credential is used when the hook is executed which may be passed on to the BugNET Web service and logging (when integrated auth is used).
This could be an issue if your environment is not under Active Directory (standalone servers) as the
username/passwords will need to be synched across the servers.

- File server hosts source (either file system or http/https)
- Web server hosts BugNET
- Database server hosts BugNET Db

User Commits to central repo (File server) ->
hook is executed (File server) ->
Web service called (Web server) -> Save revision called (Database server)
Logging called (Database server)

In a windows auth environment the users credentials will be passed along through all servers.

{anchor:Subversion (SVN)]

Subversion (SVN)

Connect your Subversion Server to BugNET

To enable integration between BugNET and a Subversion (SVN) repository please follow these steps:
  • Connect your Subversion Server to BugNET
  • Configure your Subversion Repository (optional)

Connect your Subversion Server to BugNET

  1. Copy the post-commit.bat file from the BugNET.SubversionHooks folder in the installation package to the hooks folder of your subversion repository.
  2. Open the post-commit.bat file in notepad or another texteditor and make sure the directory specified where the BugNET.SubversionHooks executable is located. (The BugNET.SubversionHooks executable must be on the same machine as your subversion server but the BugNET web application can be on another server).
  3. Open the BugNET.SubversionHooks.exe.config file in notepad or another text editor and change the following properties:

BugNetServicesUrl The url location of where your bugnet installation is located. eg. http://myserver/BugNET/WebServices/BugNetServices.asmx
BugNetUsername The username of a user that has access to the application.
BugNetPassword The password of the username in which you specified for the BugNetUsername field.
SubversionBinDirectory If your subversion executables are not in the PATH environment variable you can specify where your subversion installation is. eg. C:\Program Files\SVN\bin
BugNetWindowsAuthentication If you are using windows authentication for your BugNET installation set this to True.
IssueIdRegEx This is the regular expression used to look for Issue Id's in subversion log comments. For most installations this is fine but advanced users can modify this as necessary. The default format is ProjectCode-IssueId.

To view your subversion repository within BugNET, set the Subversion Url setting from the Edit Project -> Project Administration > Subversion tab. Click Save. This will enable the Repository tab in the main menu.

Currently SVN integration is limited to Windows only. For Linux support a similar executable or script needs to be made. If you are interested in contributing this to the project please post in the discussion forums.

Configure your Subversion Repository (optional)

Set the following bugtraq properties on the repository:

bugtraq:message View Issue ProjectCode-%BUGID%
bugtraq:url http://myserver/Issues/IssueDetail.aspx?id=%BUGID%
bugtraq:number true
bugtraq:label Issue ID:
bugtraq:warnifnoissue true

Note ProjectCode is the project identifier of the project you are working with, SVN will append it to the log entry as a hyperlink to the bugtraq:url. In the Issue ID field in Tortoise (or whatever client you use) enter only the numeric portion of the issue ID.

Last edited Aug 15, 2014 at 2:34 PM by dubeaud, version 13