Package tracopt :: Package ticket :: Module commit_updater :: Class CommitTicketUpdater

Class CommitTicketUpdater

source code

         object --+    
                  |    
trac.core.Component --+
                      |
                     CommitTicketUpdater

Update tickets based on commit messages.

This component hooks into changeset notifications and searches commit messages for text in the form of: {{{ command #1 command #1, #2 command #1 & #2 command #1 and #2 }}}

Instead of the short-hand syntax "#1", "ticket:1" can be used as well, e.g.: {{{ command ticket:1 command ticket:1, ticket:2 command ticket:1 & ticket:2 command ticket:1 and ticket:2 }}}

Using the long-form syntax allows a comment to be included in the reference, e.g.: {{{ command ticket:1#comment:1 command ticket:1#comment:description }}}

In addition, the ':' character can be omitted and issue or bug can be used instead of ticket.

You can have more than one command in a message. The following commands are supported. There is more than one spelling for each command, to make this as user-friendly as possible.

close, closed, closes, fix, fixed, fixes::
The specified tickets are closed, and the commit message is added to them as a comment.
references, refs, addresses, re, see::
The specified tickets are left in their current status, and the commit message is added to them as a comment.

A fairly complicated example of what you can do is with a commit message of:

Changed blah and foo to do this or that. Fixes #10 and #12, and refs #12.

This will close #10 and #12, and add a note to #12.

Nested Classes

Inherited from trac.core.Component: __metaclass__

Instance Methods
 
changeset_added(self, repos, changeset) source code
 
changeset_modified(self, repos, changeset, old_changeset) source code
 
make_ticket_comment(self, repos, changeset)
Create the ticket comment from the changeset data.
source code
 
cmd_close(self, ticket, changeset, perm) source code
 
cmd_refs(self, ticket, changeset, perm) source code

Inherited from trac.core.Component: __repr__

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __init__, __new__, __reduce__, __reduce_ex__, __setattr__, __sizeof__, __str__, __subclasshook__

Static Methods

Inherited from trac.core.Component: implements

Class Variables
  envelope = <Option [ticket] 'commit_ticket_update_envelope'>
  commands_close = <Option [ticket] 'commit_ticket_update_comman...
  commands_refs = <Option [ticket] 'commit_ticket_update_command...
  check_perms = <BoolOption [ticket] 'commit_ticket_update_check...
  notify = <BoolOption [ticket] 'commit_ticket_update_notify'>
  ticket_prefix = '(?:#|(?:ticket|issue|bug)[: ]?)'
  ticket_reference = '(?:#|(?:ticket|issue|bug)[: ]?)[0-9]+(?:#c...
  ticket_command = '(?P<action>[A-Za-z]*)\\s*.?\\s*(?P<ticket>(?...
  ticket_re = re.compile(r'(?:#|(?:ticket|issue|bug)[: ]?)([0-9]...
Properties
  command_re

Inherited from object: __class__

Class Variable Details

commands_close

Value:
<Option [ticket] 'commit_ticket_update_commands.close'>

commands_refs

Value:
<Option [ticket] 'commit_ticket_update_commands.refs'>

check_perms

Value:
<BoolOption [ticket] 'commit_ticket_update_check_perms'>

ticket_reference

Value:
'(?:#|(?:ticket|issue|bug)[: ]?)[0-9]+(?:#comment:([0-9]+|description)\
)?'

ticket_command

Value:
'(?P<action>[A-Za-z]*)\\s*.?\\s*(?P<ticket>(?:#|(?:ticket|issue|bug)[:\
 ]?)[0-9]+(?:#comment:([0-9]+|description))?(?:(?:[, &]*|[ ]?and[ ]?)(\
?:#|(?:ticket|issue|bug)[: ]?)[0-9]+(?:#comment:([0-9]+|description))?\
)*)'

ticket_re

Value:
re.compile(r'(?:#|(?:ticket|issue|bug)[: ]?)([0-9]+)')

Property Details

command_re

Get Method:
unreachable.command_re(self)