Perforce Plugin for Trac

Notice: This plugin is unmaintained and available for adoption.


This is a plugin for Trac (0.10 or 0.11) which enables Perforce to be used instead of Subversion for the Versioning Control System. Perforce itself is proprietary licensed. This plugin now supports most of the features of Subversion and should be able to handle reasonably large Perforce repositories. See trac:#257 for more information.

Key features:

  • Browsing source code in a Perforce repository via the TracBrowser.
  • Specifying revisions using change number, file revision, date or label.
  • Viewing the change history of a file or directory using TracRevisionLog.
  • Performing diffs between any two files or two directories.
  • Displaying submitted changes in the TracTimeline.
  • Caching TracChangeset information in Trac's database.
  • Using the TracSearch page to search change descriptions.
  • Unicode enabled Perforce servers.
  • Displaying Perforce file attributes: an undocumented Perforce feature similar to Subversion properties.
  • Efficient handling of large repository files.
  • Multi-threaded web servers, eg Apache with mod_python on Windows.

For a list of features that still need to be implemented see this list.


The plugin was originally based on work from Christian Boos on the TracMercurial plugin, Jason Parks and Thomas Tressieres.

The plugin has been reworked by Lewis Baker to try to improve handling of large repositories and large files. The plugin was also ported to use PyPerforce to take advantage of its support for Python's unicode strings, multi-threading and streaming of results.

Bugs/Feature requests

Existing bugs and feature requests for the PerforcePlugin are here.

If you have an issues, create a new ticket.


15 / 37


6 / 16


3 / 4


The latest version (0.4.3) can be found here (for Trac 0.11 only).


The latest developmental version can be browsed or downloaded.

The branch for trac-0.10 support can also be browsed or downloaded.

Tagged releases can be browsed here.



The PerforcePlugin has been tested against Perforce 2002.2, 2005.1 and 2005.2 servers.

Installation steps

  1. Download and install the requirements, see above.
  1. Build the .egg file if building from source. Run:
    $ python bdist_egg
  1. Install the .egg file
    • For per-project installation copy the .egg file to the <TRAC_ENV>/plugins directory.
    • For a global installation run:
      $ easy_install path/to/TracPerforce-0.4.3-py2.4.egg
      $ python install


You need to edit your <TRAC_ENV>/conf/trac.ini file.

In the [trac] section you need to add:

repository_type = perforce
repository_dir = /

port = perforce:1666
user = p4trac
password = secret
unicode = 0

One recommended Perforce configuration is to add a user with read access and a login with no expiry, then setup your Trac configuration with this user and use the Perforce ticket as the password.

If you installed trac globally you also need to enable the PerforcePlugin in the [components] section of your trac.ini file:

p4trac.* = enabled

Finally, restart your Trac web server.

Note: Loading a page that uses the plugin for the first time can take a long time while the plugin populates the initial changeset cache, depending on the size of the Perforce repository. See #630 for more info.


This is a brief list of some of the future work that needs to be done:

  • Replication of Trac tickets to Perforce jobs, eg P4DTI (#625)
  • Add support for Trac 0.11 (#2338)
  • Add a 'fixes' property to changesets that lists tickets/jobs fixed by that change (#628)
  • Detect 'move' file actions (ie 'copy' and 'delete' of same file) (#626)
  • Detect 'move' and 'copy' of entire directories (#627)
  • Add an 'integrations' property to changesets/files that lists integrated revisions merged in that revision (#629)
  • Fix 'created_rev' to report the revision of last 'edit', skipping 'copy' or 'move' revisions (#633)
  • Better support for detecting modified change descriptions and updating changeset cache (use "p4 logger"?).
  • Per-user authentication and authorisation (#635)
  • Auto-detection of Unicode Perforce servers (#634)


Alternatively, Trac can access Perforce through a git wrapper. Here's roughly what you need to do:

  1. Install and set up a git-p4 repository: download, HowTo1, HowTo2
  2. Install GitPlugin and use the git repository you set up above as your new Trac repository.
  3. Create a minutely cronjob that executes "git p4 rebase" for your repository.

Recent Changes

16905 by rjollos on 2017-10-20 17:59:25
TracPerforce 0.5.0dev: Adapt to Trac 0.12

Fixes #6992.

16495 by rjollos on 2017-04-15 08:21:14
Fix indentation
15876 by rjollos on 2016-09-07 21:53:36
Remove obsolete branch


Author: ttressieres
Maintainer: none (needsadoption)

Last modified 12 months ago Last modified on May 13, 2020, 11:08:21 PM