wiki:TracTicketChangesetsPlugin

Version 1 (modified by Mikael Relbe, 14 years ago) (diff)

New hack TracTicketChangesetsPlugin, created by mrelbe

Ticket Changesets Plugin

Description

The TracTicketChangesetsPlugin hooks into changeset notifications and searches commit messages for ticket references. Referenced tickets are updated with the commit message, and all concerning changesets for a ticket are presented in a separate section on ticket pages, just above the ordinary change section.

The macros CommitMessage(repo, rev) and TicketChangesets(ticket) are provided to present a commit message for a given repository and revision, and all changesets that are related to a given ticket.

Console administration commands are available for resynchronizing relations between tickets and changesets.

The source of this plugin is based on code provided distributed with Trac 0.12 (tracopt/ticket/commit_updater.py).

This plugin is not compatible with Trac 0.11

Bugs/Feature Requests

Existing bugs and feature requests for TracTicketChangesetsPlugin are here.

If you have any issues, create a new ticket.

Download

Download the zipped source from [download:tracticketchangesetsplugin here].

Source

You can check out TracTicketChangesetsPlugin from here using Subversion, or browse the source with Trac.

Example

Installation instructions

  1. Enable the plugin by the following in trac.ini:
    [components]
    ticketchangesets.* = enabled
    
  2. Add the section [ticket-changesets] to configure the behaviour:
    [ticket-changesets]
    check_perms = true
    collapsed = false
    commands.close = close closed closes fix fixed fixes
    commands.refs = addresses re refs references see ticket tickets
    compact = false
    hide_when_none = false
    notify = false
    resolution = fixed
    
  3. The Trac environment needs to be upgraded:
    trac-admin $ENV upgrade
    
  4. Re-synchronize repositories (optional, but recommended before next step which will scan all existing commit messages):
    trac-admin $ENV repository resync "*"
    
  5. Build relations between tickets and changesets:
    trac-admin $ENV ticket_changesets resync
    
  6. Re-format existing ticket commit messages (DANGEROUS!)
    1. Produce a diff-like output for your analysis, which does not affect the database, before re-formatting existing commit messages:
      trac-admin $ENV ticket_changesets diff > out.diff
      
      Examine out.diff and assert that re-formatting is sensible before next step.
    2. Re-format (DANGEROUS!)
      trac-admin $ENV ticket_changesets reformat
      
  7. Setup hook-scripts (Windows example, does not differ from official instructions applicable to Trac 0.12):
    1. post-commit.cmd
      :: Trac 0.12 post-commit hook script for Windows
      ::
      @SET TRAC_ENV=...
      @SET REPOS=%1
      @SET REV=%2
      @trac-admin "%TRAC_ENV%" changeset added "%REPOS%" "%REV%"
      
    2. post-revprop-change.cmd
      :: Trac 0.12 post-revprop-change hook script for Windows
      ::
      @SET TRAC_ENV=...
      @SET REPOS=%1
      @SET REV=%2
      @trac-admin "%TRAC_ENV%" changeset modified "%REPOS%" %REV%
      

From here-on, tickets will be updated when referenced in a commit message, and the relation between tickets and revisions are automatically tracked.

Recent Changes

17869 by rjollos on 2020-10-26 18:43:59
1.0dev: Fix formatting using autopep8

Refs #13897.

16184 by rjollos on 2017-01-18 04:23:52
1.0dev: Change id to avoid duplicate ids on ticket page

Untested change. Refs #13046.

15264 by rjollos on 2016-02-11 04:22:34
Remove unnecessary svn:mime-type on py files

svn:mime-type was set to "plain" for many files.

(more)

Author/Contributors

Author: mrelbe
Maintainer: mrelbe
Contributors:

Attachments (1)

Download all attachments as: .zip