| | 1 | = Hacking Trac for code.djangoproject.com = |
| | 2 | |
| | 3 | For posterity -- and for when we upgrade! -- this page contains a list of all the things I've done to modify Trac for code.djangoproject.com. |
| | 4 | |
| | 5 | == Plugins == |
| | 6 | |
| | 7 | Most of the work comes from a set of plugins from [http://trac-hacks.org/ Trac Hacks]. This installation is using the following plugins: |
| | 8 | |
| | 9 | * [http://trac-hacks.org/wiki/NavAddPlugin NavAdd] |
| | 10 | * [http://trac-hacks.org/wiki/NavHiderPlugin NavHider] |
| | 11 | * [http://trac-hacks.org/wiki/SimpleTicketPlugin SimpleTicket] |
| | 12 | * [http://trac.edgewall.org/wiki/SpamFilter TracSpamFilter] |
| | 13 | * [http://trac.edgewall.org/wiki/WebAdmin WebAdmin] |
| | 14 | * [http://trac-hacks.org/wiki/TocMacro TocMacro] |
| | 15 | |
| | 16 | Most of them are easy to install -- just check out the source, {{{python setup.py bdist_egg}}}, and copy the egg to plugins. |
| | 17 | |
| | 18 | I did have to make one trivial bug fix for Python 2.3 to the !NavHider plugin: |
| | 19 | |
| | 20 | {{{ |
| | 21 | Index: navhider/filter.py |
| | 22 | =================================================================== |
| | 23 | --- navhider/filter.py (revision 1926) |
| | 24 | +++ navhider/filter.py (working copy) |
| | 25 | @@ -4,7 +4,7 @@ |
| | 26 | |
| | 27 | try: |
| | 28 | set = set |
| | 29 | -except ImportError: |
| | 30 | +except NameError: |
| | 31 | from sets import Set as set |
| | 32 | |
| | 33 | __all__ = ['NavHiderModule'] |
| | 34 | }}} |
| | 35 | |
| | 36 | == Custom fields == |
| | 37 | |
| | 38 | Most of the fields used by out [http://www.djangoproject.com/documentation/contributing/#ticket-triage ticket workflow] are added using Trac's [http://trac.edgewall.org/wiki/TracTicketsCustomFields custom field feature]. See the {{{[ticket-custom]}}} section in the ini below. |
| | 39 | |
| | 40 | == Configuration == |
| | 41 | |
| | 42 | There's a lot of config stuff in trac.ini, much of which is just there by default. These are the important bits: |
| | 43 | |
| | 44 | {{{ |
| | 45 | [browser] |
| | 46 | downloadable_paths = /django/trunk, /django/branches/*, /django/tags/*, /django_website |
| | 47 | hide_properties = svk:merge, svn:ignore |
| | 48 | |
| | 49 | [navadd] |
| | 50 | add_items = reports, simpleticket |
| | 51 | reports.target = mainnav |
| | 52 | reports.title = Reports |
| | 53 | reports.url = /wiki/Reports |
| | 54 | simpleticket.target = mainnav |
| | 55 | simpleticket.title = New Ticket |
| | 56 | simpleticket.url = /simpleticket |
| | 57 | |
| | 58 | [notification] |
| | 59 | always_notify_owner = true |
| | 60 | always_notify_reporter = true |
| | 61 | always_notify_updater = true |
| | 62 | |
| | 63 | [simpleticket] |
| | 64 | hide = stage, needs_tests, needs_docs, needs_better_patch |
| | 65 | |
| | 66 | [ticket-custom] |
| | 67 | has_patch = checkbox |
| | 68 | has_patch.label = Has patch |
| | 69 | has_patch.order = 20 |
| | 70 | needs_better_patch = checkbox |
| | 71 | needs_better_patch.label = Patch needs improvement |
| | 72 | needs_better_patch.order = 50 |
| | 73 | needs_docs = checkbox |
| | 74 | needs_docs.label = Needs documentation |
| | 75 | needs_docs.order = 30 |
| | 76 | needs_tests = checkbox |
| | 77 | needs_tests.label = Needs tests |
| | 78 | needs_tests.order = 40 |
| | 79 | stage = select |
| | 80 | stage.label = Triage Stage |
| | 81 | stage.options = Unreviewed|Design decision needed|Accepted|Ready for checkin |
| | 82 | stage.order = 10 |
| | 83 | stage.value = 0 |
| | 84 | |
| | 85 | [trac] |
| | 86 | mainnav = wiki,timeline,browser,reports,tickets,-newticket,simpleticket,search |
| | 87 | metanav = -about,login,logout,settings,-help |
| | 88 | }}} |
| | 89 | |
| | 90 | == Hooks == |
| | 91 | |
| | 92 | We use a couple of SVN post-commit hooks to send the checkin notifications to django-updates and to update Trac from "Fixed #XXX" messages. Our post-commit hook: |
| | 93 | |
| | 94 | {{{ |
| | 95 | #!/bin/sh |
| | 96 | |
| | 97 | export PYTHONPATH=/home/trac/ |
| | 98 | |
| | 99 | REPOS="$1" |
| | 100 | REV="$2" |
| | 101 | LOG=`/usr/bin/svnlook log -r $REV $REPOS` |
| | 102 | AUTHOR=`/usr/bin/svnlook author -r $REV $REPOS` |
| | 103 | TRAC_ENV='/home/trac/django.tracenv/' |
| | 104 | TRAC_URL='http://code.djangoproject.com/' |
| | 105 | |
| | 106 | /usr/bin/python2.3 /home/trac/trac-0.10.3/contrib/trac-post-commit-hook \ |
| | 107 | -p "$TRAC_ENV" \ |
| | 108 | -r "$REV" \ |
| | 109 | -u "$AUTHOR" \ |
| | 110 | -m "$LOG" \ |
| | 111 | -s "$TRAC_URL" |
| | 112 | |
| | 113 | /home/svn/django/hooks/commit-email.pl \ |
| | 114 | "$REPOS" \ |
| | 115 | "$REV" \ |
| | 116 | -s "[Changeset]" \ |
| | 117 | --from noreply@djangoproject.com \ |
| | 118 | django-updates@googlegroups.com |
| | 119 | }}} |
| | 120 | |
| | 121 | == Templates == |
| | 122 | |
| | 123 | I've deliberately avoided hacking any built-in trac templates so that upgrades aren't quite so painful. I've thus only edited {{{site_css.cs}}} {{{site_footer.cs}}}}, {{{site_header.cs}}}, and {{{site_newticket.cs}}}. |