Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Needless to say, current Trac stable is 0.12.3, but of course development needs to go with your current version. (You didn't tell us in you question.)</p> <p>On you question, there is <a href="http://trac.edgewall.org/ticket/9753" rel="nofollow">a hint</a> on how to implement different functionality on-top of the <em>CommitTicketUpdater</em> from Trac core. It has update and close as built-in actions, so you'll need to do some change like so (based on <a href="http://trac.edgewall.org/browser/trunk/tracopt/ticket/commit_updater.py?rev=10968" rel="nofollow">current Trac <code>trunk</code></a>):</p> <ul> <li>create an additional option <code>commands_create</code> for <em>commands, that create a new ticket with reference to the changeset, as a space-separated list</em></li> <li>add a class-wide variable <code>self.comment</code> in both of <code>changeset_added</code> and <code>changeset_modified</code> right after <code>comment</code> assignment</li> <li><p>add a module <code>cmd_create</code> like (<em>untested</em>)</p> <blockquote> <pre><code>def cmd_create(self, ticket, changeset, perm): if not self.check_perms or 'TICKET_CREATE' in perm: # Commit messages in general is used for a ticket comment. # New tickets require summary and we'll want description too, # because comment is ignored on ticket creation. # So we need to do message processing here beforehand. ticket['comment'] = None ticket['description'] = self.comment ticket['owner'] = changeset.author ticket['status'] = 'new' ticket['summary'] = ' '.join(['TODO from', str(changeset.rev)]) ticket.insert() </code></pre> </blockquote></li> <li><p>alter <code>ticket_command</code> so the regexp matches not only the default function-ticket(s) pairs but the unary 'TODO:' as well (sorry, can't make this working right-away now)</p></li> <li><p>extend the private module <code>_parse_message</code> to include another case before <code>if func:</code></p> <blockquote> <pre><code> if cmd.startswith('TODO'): tickets.update({None : ['create']}) continue </code></pre> </blockquote></li> <li><p>change <code>_update_tickets</code> to make the comment saving conditional, because you won't need/want an additional comment on new tickets) </p> <blockquote> <pre><code> if ticket['comment']: ticket.save_changes(changeset.author, comment, date, db) </code></pre> </blockquote></li> </ul> <p>Ok, ask back as required, if you like to try this approach.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload