File: //usr/lib/python3/dist-packages/tracopt/ticket/__pycache__/commit_updater.cpython-310.pyc
o
�k�`�4 � @ s d dl Z d dlZd dlmZmZ d dlmZmZ d dlm Z d dl
mZ d dlm
Z
d dlmZ d dlmZ d d lmZ d d
lmZmZ d dlmZ d dlmZ d d
lmZmZ d dlmZm Z d dl!m"Z" d dl#m$Z$ d dl%m&Z& G dd� de�Z'G dd� de&�Z(dS )� N)�
BoolOption�Option)� Component�
implements)�NotificationSystem)�PermissionCache)�Resource)�Ticket)�TicketChangeEvent)�as_int)�datetime_now�utc)�tag)�exception_to_unicode)�_� cleandoc_)�IRepositoryChangeListener�RepositoryManager)�ChangesetModule)�format_to_html)�
WikiMacroBasec @ s� e Zd ZdZee� edddd�Zedddd�Zedd d
d�Z e
ddd
d�Ze
ddd
d�ZdZ
e
d Zdeef Zedd� �Ze�e
d �ZdZdd� Zdd� Zdd� Zdd� Zd d!� Zd"d#� Zd$d%� Zd&d'� Zd(d)� Zd*d+� Zd,d-� Z dS ).�CommitTicketUpdatera� 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.
�ticket�commit_ticket_update_envelope� z�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]`.z#commit_ticket_update_commands.closez#close closed closes fix fixed fixesz7Commands that close tickets, as a space-separated list.z"commit_ticket_update_commands.refsz addresses re references refs seez�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.� commit_ticket_update_check_perms�truez�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.�commit_ticket_update_notifyz7Send ticket change notification when updating a ticket.z(?:#|(?:ticket|issue|bug)[: ]?)z([0-9]+(?:#comment:([0-9]+|description))?zH(?P<action>[A-Za-z]*)\s*.?\s*(?P<ticket>%s(?:(?:[, &]*|[ ]?and[ ]?)%s)*)c C s>