All pastes #1898997 Raw Edit

Someone

public text v1 · immutable
#1898997 ·published 2010-07-12 13:58 UTC
rendered paste body
I recommend extending [TracTicketChangesetsPlugin][1] to do this.

You would adjust the way it detects the command in the commit message (see http://trac-hacks.org/browser/tracticketchangesetsplugin/trunk/ticketchangesets/commit_updater.py?rev=8114#L154), as you would not have a ticket number to refer to yet.

See http://trac-hacks.org/browser/tracticketchangesetsplugin/trunk/ticketchangesets/commit_updater.py?rev=8114#L215 for where it actually does the parsing. You would have to return some new token to represent "new ticket."

The code that actually changes the tickets is at http://trac-hacks.org/browser/tracticketchangesetsplugin/trunk/ticketchangesets/commit_updater.py?rev=8114#L234 , so here would you create NEW ticket, then close it straight away. To create a new ticket, call Ticket(self.env) and then save it with Ticket.insert() (see http://trac.edgewall.org/browser/trunk/trac/ticket/model.py?rev=9692#L174 ).

If you do this, I recommend attaching your patch to a [new ticket at Trac Hacks][2].


  [1]: http://trac-hacks.org/wiki/TracTicketChangesetsPlugin
  [2]: http://trac-hacks.org/newticket?component=TracTicketChangesetsPlugin&owner=mrelbe