Edgewall Software
Modify

Opened 7 years ago

Closed 7 years ago

Last modified 7 years ago

#12628 closed enhancement (wontfix)

Add configuration options to CommitTicketUpdater to disable short form of ticket references

Reported by: Jean-Paul Calderone <exarkun@…> Owned by:
Priority: normal Milestone:
Component: general Version:
Severity: normal Keywords:
Cc: Branch:
Release Notes:
API Changes:
Internal Changes:

Description

CommitTicketUpdater notices ticket references like #NNN. This is usually just the right thing to do. However, if a project uses trac and GitHub, then there is confusion between whether a #NNN reference means a trac ticket or a GitHub issue or pull request.

An easy fix is to use ticket:NNN for trac tickets and #NNN for GitHub items.

If CommitTicketUpdater had a config toggle that controlled whether it discovered the short form or not, it would be easy to implement this fix.

For now, I've forked CommitTicketUpdater and hacked up the code so its regexp only detects ticket:NNN. It would be great to be able to switch back to the upstream plugin and just tweak some configuration.

Attachments (0)

Change History (2)

comment:1 by Ryan J Ollos, 7 years ago

Resolution: wontfix
Status: newclosed

The configuration option would only be useful for your limited use case. If we satisfied every request like this we'd be drowning in config options.

There's a simple solution, just create a single-file plugin and drop it in your Environment plugins directory. In the single-file plugin, subclass CommitTicketUpdater and modify ticket_prefix. It's unlikely to ever break and you don't have to fork the code.

from tracopt.ticket.commit_updater import CommitTicketUpdater


class CustomCommitTicketUpdater(CommitTicketUpdater):

    ticket_prefix = '(?:(?:ticket|issue|bug)[: ]?)'

Disable the standard CommitTicketUpdater by including this in the [components] section of trac.ini:

tracopt.ticket.commit_updater.CommitTicketUpdater = disabled

This is untested, but I've done similar things in MultiProjectCommitTicketUpdaterPlugin. If it doesn't work as expected, that's probably due to ticket_prefix being a class attribute and therefore not behaving quite the way I expect. I think with a little tweaking it can be made to work.

Posting a working solution back here could be very useful in case anyone else needs to solve the same problem.

For other solutions see:

Last edited 7 years ago by Ryan J Ollos (previous) (diff)

comment:2 by Jean-Paul Calderone <exarkun@…>, 7 years ago

Posting a working solution back here could be very useful in case anyone else needs to solve the same problem.

Ah, but it's only useful for my limited use case. So that would clearly be a waste of time.

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The ticket will remain with no owner.
The resolution will be deleted. Next status will be 'reopened'.
to The owner will be changed from (none) to the specified user.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.