wiki:PerforcePlugin

Version 7 (modified by athomas, 9 years ago) (diff)

--

Perforce Plugin for Trac

(See Trac ticket [trac-ticket:257 #257] for more information)

This is an experimental plugin for Trac [milestone:0.9] which enables Perforce to be used instead of Subversion for the VersioningSystemBackend.

It is based on work from ChristianBoos on TracMercurial plugin and from JasonParks.

The plugin being experimental, expect some rough edges and a somewhat instable set of features/documentation...

Download and Installation

Sources

the sources are here or you can download a zip file here . To build the egg, you must do this on Windows platform:

d:\dev\Python23\python.exe setup.py bdist_egg

Trac

The plugin needs a slightly modified version of Trac 0.9, which offers support for pluggable SCM backends. This version can be found in vc-refactoring.

Perforce

The plugin has been tested with Perforce 2005.1 and 2005.2.Beta from http://www.perforce.com.

You can try Perforce from Perforce/Download.

Configuration

The configuration has to be done on the Trac side, there's nothing to do on the Perforce repository side, except that it should be made available locally.

Setting up a Trac environment

You can either reuse an existing Trac environment, or create a brand new one.

For general instructions, see TracInstall.

The TracAdmin initenv command has been slightly modified in the vc-refactoring code base: in addition to the repository directory, it's also needed to specify the repository type.

For the repository type, specify p4 instead of the default svn. For the repository directory, the plugin doesn't use this entry.

In all case, you <trac_environment>/conf/trac.ini configuration file should have a [trac] section similar to the following:

[trac]
repository_type = p4
repository_dir = <anything>

Also, currently you still need to explicitely disable the SVN components and enable p4trac

[components]
trac.versioncontrol.svn_fs.* = disabled
p4trac.* = enabled

Note: that constraint will most certainly be lifted in the future

to specify Perforce user and password you must add a [p4] section in trac.ini

[p4]
port = server:1666
user = ttressieres
client = my_workspace
passwd = 200DA71E463444DA246E94F69633C9DE
max_changes = 1000

Note: The best Perforce configuration is to add a user with read access and a login with no expiry, then you set your Trac configuration with this user.

Setting up the perforce plugin

The TracPerforce-0.1 plugin egg should be added to the plugins folder of the environment.

For general instructions about plugins, see also TracPlugins.

Features

The Perforce support is pretty basic, but works well. I've tested that on the Perforce repository itself and the performance is quite good, even if there's currently no caching in the database (I'm still not decided if that's a feature or a bug).

For those used to Subversion in general and Subversion repository browsing in Trac in particular, there are very minor differences.

Bugs and Limitations

  • There are still a lot of things that can be improved.
  • bad handling of special characters (such as è,é,... )

Features that Trac+svn has but not currently implemented for Trac+p4

  • The database is not used
  • move of files and directories are not taken into account
  • history is not updated
    • if you want to see a change before the 'max_changes' number specified in trac.ini, an error occured !!

Add your cool feature here...


Implementation Notes

I'm interested in feedback concerning the code, in particular:

  • concerning Perforce, I'm pretty sure I did things in a sub-optimal way, as I was discovering the guts of p4 and Python while writing the plugin. Therefore, I'll be pleased to get tips for improvements.

-- Thomas Tressieres

TagIt(0.9,plugin,ttressieres)?

Attachments (4)

Download all attachments as: .zip