tracopt.ticket.commit_updater
¶
-
class
tracopt.ticket.commit_updater.
CommitTicketUpdater
¶ Bases:
trac.core.Component
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.
-
check_perms
¶ Check that the committer has permission to perform the requested operations on the referenced tickets.
This requires that the user names be the same for Trac and repository operations.
-
commands_close
¶ Commands that close tickets, as a space-separated list.
-
commands_refs
¶ Commands that add a reference, as a space-separated list.
If set to the special value
<ALL>
, all tickets referenced by the message will get a reference to the changeset.
-
envelope
¶ Require commands to be enclosed in an envelope.
Must be empty or contain two characters. For example, if set to
[]
, then commands must be in the form of[closes #4]
.
-
make_ticket_comment
(repos, changeset)¶ Create the ticket comment from the changeset data.
-
notify
¶ Send ticket change notification when updating a ticket.
-
tracopt.ticket.commit_updater.
datetime_now
()¶ [tz] -> new datetime with tz’s local day and time.