Use TRAC 0.12 with visual SVN

Source: Internet
Author: User

After trying for a long time, I finally integrated TRAC 0.12 on visual SVN.

After the installation is complete, record the operation process for creating a TRAC project.

1. Create a TRAC Project

Assume that the tracproject directory is set to D: \ Trac to ensure that the network service user has full access permissions to it.

The name of the project to be createdMSSIn the command line, enter:

Trac-Admin D: \ TRAC \ MSSInitenv

Press enter to use the SQLite database. Enter the project name when you ask for the project name (which can be modified later:MSSWait a few seconds before the TRAC Initialization is complete.

2. Integrate Trac to the Apache server of visualsvn

Here I use the mod_wsgi recommended by TRAC, which is used to integrate Trac to Apache.

Suppose that visual SVN is installed in c: \ Program Files \ visualsvn server; The SVN version library root directory is set in D:/svnrepository

Open c: \ Program Files \ visualsvn Server \ conf \ httpd-custom.conf

Add the following code:

Loadmodule wsgi_module bin/mod_wsgi.so
Loadmodule authz_user_module bin/mod_authz_user.so

Wsgiscriptalias/TRAC/MSSD: \ TRAC \MSS\ TRAC. wsgi

<Directory D: \ TRAC>
Wsgiapplicationgroup % {Global}
# Order deny, allow
# Allow from all
</Directory>

<Location '/'>
Authtype basic
Authname "trac"
Authuserfile D:/svnrepository/htpasswd
Require valid-user
</Location>

I copied the above D: \ TRAC \ MSS \ TRAC. wsgi script file in the format of TRAC deploy:

#! C: \ python27 \ python.exe
#-*-Coding: UTF-8 -*-
#
# Copyright (c) 2008-2009 edgewall Software
# Copyright (c) 2008 Noah Kantrowitz <noah@coderanger.net>
# All Rights Reserved.
#
# This software is licensed as described in the file copying, which
# You shoshould have received as part of this distribution. The terms
# Are also available at http://trac.edgewall.org/wiki/TracLicense.
#
# This software consists of voluntary contributions made by role
# Individuals. For the exact contribution history, see the revision
# History and logs, available at http://trac.edgewall.org/log.
#
# Author: Noah Kantrowitz <noah@coderanger.net>
Import OS

Def application (Environ, start_request ):
If not 'trac. env_parent_dir 'in environ:
Environ. setdefault ('trac. env_path ', 'd: \ TRAC \\MSS')
If 'python _ egg_cache 'in environ:
OS. Environ ['python _ egg_cache '] = environ ['python _ egg_cache']
Elif 'trac. env_path' in environ:
OS. Environ ['python _ egg_cache '] = \
OS. Path. Join (Environ ['trac. env_path'], '. Egg-cache ')
Elif 'trac. env_parent_dir 'in environ:
OS. Environ ['python _ egg_cache '] = \
OS. Path. Join (Environ ['trac. env_parent_dir '],'. Egg-cache ')
From TRAC. Web. Main import dispatch_request
Return dispatch_request (Environ, start_request)

The preceding settings indicate:

ProjectMSSThe access address is http: // server address/TRAC/MSS;

Use the built-in user account of visual SVN to log on;

Prohibit anonymous access.

To allow anonymous access, you can

<Location '/'>
Authtype basic
Authname "trac"
Authuserfile D:/svnrepository/htpasswd
Require valid-user
</Location>

Replace

<Location/TRAC/MSS/login>
Authtype basic
Authname "Trac MSS"
Authuserfile D:/svnrepository/htpasswd
Require valid-user
</Location>

In this way, when you click the TRAC logon link, the authentication box will pop up asking you to log on.

To add a new TRAC Project (such as a newly created Project)Cmscs) Just add a line in the httpd-custom.conf:

Wsgiscriptalias/TRAC/ CmscsD: \ TRAC \ Cmscs\ TRAC. wsgi

Then copy TRAC. wsgiCmscsDirectory.

If the project requires separate permissions, you can add

<Location/TRAC/ Cmscs/Login>
Authtype basic
Authname "Trac Cmscs"
Authuserfile D:/svnrepository/htpasswd
Require valid-user
</Location>

3. Set the WebAdmin user

WebAdmin allows you to manage TRAC configurations from the web interface and build it into TRAC from version 0.12.

We want the specified user to have the WebAdmin permission.

Command Line input:

Trac-Admin D: \ TRAC \ MSS
Permission add xwing trac_admin
Permission list xwing

The User Name xwing must have a corresponding user in visualsvn.

4. Associate the SVN version Library

In trac0.12, multiple SVN version libraries can be associated with a project.

Assume that the root directory of the visualsvn version library is located in D: \ svnrepository, which is already a projectMSSCreate an SVN version library at D: \ svnrepository \MSS

You can add the svn repository to TRAC in either of the following ways.

Open D: \ TRAC \MSS\ Conf \ TRAC. ini

Add the following content:

[Repositories]
MSS. dir = D:/svnrepository/ MSS
MSS. Description = MSS
MSS. type = SVN
MSS. url = http: // server address/SVN/ MSS
. Alias = MSS
. Hidden = true

After saving, refresh the page to see the browsing Source Code menu. And the MSS version library is set to the default value.

To add multiple version libraries, you can modify the [repositories] configuration information:

[Repositories]
MSS. Dir = D:/svnrepository/ MSS
MSS. Description = MSS
MSS. Type = SVN
MSS. Url = http: // server address/SVN/ MSS
Cmscs. Dir = D:/svnrepository/ Cmscs
Cmscs. Description = Cmscs
Cmscs. Type = SVN
Cmscs. Url =
. Alias = MSS
. Hidden = false

Note that if TRAC. INI has Chinese characters, you need to save it as a UTF-8 without Bom.

After configuring the svn repository in TRAC. ini, you can view the repository in the Management Panel of WebAdmin, but it cannot be modified.

After configuring the svn repository, you need to re-Synchronize the TRAC cache.

Enter the following command:

Trac-Admin D: \ TRAC \ MSS repository Resync" MSS"Trac-Admin D: \ TRAC \ MSS repository Resync" Cmscs"

Synchronize the two added SVN version libraries.

Or run the following command:

Trac-Admin D: \ TRAC \ MSSRepository Resync "*"

Synchronize all SVN version libraries.

5. Synchronize the SVN version Library

From trac0.12, you must add post-commit hooks to the svn service for explicit synchronization.

Right-click the MSS version library node of visual SVN and choose Properties. In the displayed dialog box, select the hooks tab.

Double-click post-commit hook. In the dialog box, enter:

 

Trac-Admin D: \ TRAC \ MSSChangeset added" MSS"" % 1 "" % 2"

Double-click post-revision property change hook. In the dialog box, enter:

Trac-Admin D: \ TRAC \ MSSChangeset modified "% 1" "% 2"

In this way, the TRAC will be notified to synchronize the version library each time it is submitted.

In TRAC. ini[Components]Segment addition:

Tracopt. Ticket. commit_updater. * = Enabled

This allows you to submit information through SVN to update the task list.

For example:

Refs #123 reference a task list #123

Fixes #123 reference and change the task ticket #123 status to closed

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.