| 1 | [[PageOutline(2-5,Contents,pullout)]] |
| 2 | |
| 3 | = Ticket Changesets Plugin = |
| 4 | |
| 5 | == Description == |
| 6 | |
| 7 | 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. |
| 8 | |
| 9 | 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. |
| 10 | |
| 11 | Console administration commands are available for resynchronizing relations between tickets and changesets. |
| 12 | |
| 13 | The source of this plugin is based on code provided distributed with Trac 0.12 (tracopt/ticket/commit_updater.py). |
| 14 | |
| 15 | '''This plugin is not compatible with Trac 0.11''' |
| 16 | |
| 17 | |
| 18 | == Bugs/Feature Requests == |
| 19 | |
| 20 | Existing bugs and feature requests for TracTicketChangesetsPlugin are |
| 21 | [report:9?COMPONENT=TracTicketChangesetsPlugin here]. |
| 22 | |
| 23 | If you have any issues, create a |
| 24 | [http://trac-hacks.org/newticket?component=TracTicketChangesetsPlugin&owner=mrelbe new ticket]. |
| 25 | |
| 26 | == Download == |
| 27 | |
| 28 | Download the zipped source from [download:tracticketchangesetsplugin here]. |
| 29 | |
| 30 | == Source == |
| 31 | |
| 32 | You can check out TracTicketChangesetsPlugin from [http://trac-hacks.org/svn/tracticketchangesetsplugin here] using Subversion, or [source:tracticketchangesetsplugin browse the source] with Trac. |
| 33 | |
| 34 | == Example == |
| 35 | |
| 36 | === Installation instructions === |
| 37 | 1. Enable the plugin by the following in trac.ini: |
| 38 | {{{ |
| 39 | [components] |
| 40 | ticketchangesets.* = enabled |
| 41 | }}} |
| 42 | 1. Add the section `[ticket-changesets]` to configure the behaviour: |
| 43 | {{{ |
| 44 | [ticket-changesets] |
| 45 | check_perms = true |
| 46 | collapsed = false |
| 47 | commands.close = close closed closes fix fixed fixes |
| 48 | commands.refs = addresses re refs references see ticket tickets |
| 49 | compact = false |
| 50 | hide_when_none = false |
| 51 | notify = false |
| 52 | resolution = fixed |
| 53 | }}} |
| 54 | 1. The Trac environment needs to be upgraded: |
| 55 | {{{ |
| 56 | trac-admin $ENV upgrade |
| 57 | }}} |
| 58 | 1. Re-synchronize repositories (optional, but recommended before next step which will scan all existing commit messages): |
| 59 | {{{ |
| 60 | trac-admin $ENV repository resync "*" |
| 61 | }}} |
| 62 | 1. Build relations between tickets and changesets: |
| 63 | {{{ |
| 64 | trac-admin $ENV ticket_changesets resync |
| 65 | }}} |
| 66 | 1. Re-format existing ticket commit messages (DANGEROUS!) |
| 67 | a. Produce a diff-like output for your analysis, which does not affect the database, before re-formatting existing commit messages: |
| 68 | {{{ |
| 69 | trac-admin $ENV ticket_changesets diff > out.diff |
| 70 | }}} |
| 71 | Examine out.diff and assert that re-formatting is sensible before next step. |
| 72 | a. Re-format '''(DANGEROUS!)''' |
| 73 | {{{ |
| 74 | trac-admin $ENV ticket_changesets reformat |
| 75 | }}} |
| 76 | 1. Setup hook-scripts (Windows example, does not differ from official instructions applicable to Trac 0.12): |
| 77 | a. post-commit.cmd |
| 78 | {{{ |
| 79 | :: Trac 0.12 post-commit hook script for Windows |
| 80 | :: |
| 81 | @SET TRAC_ENV=... |
| 82 | @SET REPOS=%1 |
| 83 | @SET REV=%2 |
| 84 | @trac-admin "%TRAC_ENV%" changeset added "%REPOS%" "%REV%" |
| 85 | }}} |
| 86 | a. post-revprop-change.cmd |
| 87 | {{{ |
| 88 | :: Trac 0.12 post-revprop-change hook script for Windows |
| 89 | :: |
| 90 | @SET TRAC_ENV=... |
| 91 | @SET REPOS=%1 |
| 92 | @SET REV=%2 |
| 93 | @trac-admin "%TRAC_ENV%" changeset modified "%REPOS%" %REV% |
| 94 | }}} |
| 95 | |
| 96 | From here-on, tickets will be updated when referenced in a commit message, and the relation between tickets and revisions are automatically tracked. |
| 97 | |
| 98 | |
| 99 | == Recent Changes == |
| 100 | |
| 101 | [[ChangeLog(tracticketchangesetsplugin, 3)]] |
| 102 | |
| 103 | == Author/Contributors == |
| 104 | |
| 105 | '''Author:''' [wiki:mrelbe] [[BR]] |
| 106 | '''Maintainer:''' [wiki:mrelbe] [[BR]] |
| 107 | '''Contributors:''' |