wiki:Developer/TracFeatures

Trac Features

There are a lot of features contained within trac to make life easier for developers and users alike. This page will attempt to explain the most useful ones for the project.


Ticket Update

One of the most useful features that ships along with trac is a post-commit-hook for  SubVersion. It will allow you to attach several commands to a commit log which will manipulate the ticket status and comments. (Note: the following was shameslly stolen from the actual  post-commit-hook.)

It searches commit messages for text in the form of:

   command #1
   command #1, #2
   command #1 & #2
   command #1 and #2

Note the lack of a ":" after the command

Also note the lack of a period at the end, this breaks the script if it is added.

You can have more then one command in a message. The following commands are supported. There is more then one spelling for each command, to make this as user-friendly as possible.

Commands

  • close, closed, closes, fix, fixed, fixes
    • The specified issue numbers are closed with the contents of this commit message being added to it.
  • references, refs, update, updates, addresses, re, see
    • The specified issue numbers are left in their current status, but the contents of this commit message are added to their notes.

Examples

  1. A fairly complicated example of what you can do is with a commit message of:
  • Changed blah and foo to do this or that. Fixes #10 and #12, and refs #12.

This will close #10 and #12, and add a note to #12.

  1. Another example can be seen in r2859 which updates 1 ticket and closes 3.

Merge Tickets

It's possible to open a ticket as a reminder to merge some code back or forwards.

It searches commit messages for text in the form of:

   command #1
   command #1, #2
   command #1 & #2
   command #1 and #2

You can have more then one command in a message. The following commands are supported. There is more then one spelling for each command, to make this as user-friendly as possible.

Commands

  • merge, merged to, merge to

Examples

  1. A fairly complicated example of what you can do is with a commit message of:
  • Changed blah and foo to do this or that. This should be merged to trunk and 2.1.8

This will open *TWO* new tickets for the trunk and 2.1.8 merge.