Edgewall Software
Modify

Opened 18 years ago

Closed 18 years ago

#3628 closed enhancement (fixed)

[PATCH] add optional literal word "ticket" to trac-post-commit-hook

Reported by: JoshuaFranklin Owned by: Jonas Borgström
Priority: normal Milestone: 0.11
Component: general Version: devel
Severity: normal Keywords:
Cc: joshuadfranklin@…, hvr@… Branch:
Release Notes:
API Changes:
Internal Changes:

Description

We make good use of the trac-post-commit-hook but developers have complained that it's awkward to put just "addresses #123" instead of "addresses ticket #123". So, I edited the regex in trac-post-commit-hook to have that optional keyword—-basically just r"(?:ticket\s+?|)"—-and we're using it in our trac installation. I also changed the regex to use re.VERBOSE and commented it fully so it's easier to read.

Attachments (1)

trac-post-commit-hook.patch (1.1 KB ) - added by JoshuaFranklin 18 years ago.

Download all attachments as: .zip

Change History (4)

by JoshuaFranklin, 18 years ago

Attachment: trac-post-commit-hook.patch added

comment:1 by Herbert Valerio Riedel <hvr@…>, 18 years ago

Cc: hvr@… added
Milestone: 0.10.1

I had the same problem, but rather prefered to keep the TracLinks syntax, and implemented something similiar to your patch, but with closes ticket:3628 instead of closes ticket 3628:

  • contrib/trac-post-commit-hook

     
    5050#   command #1 & #2
    5151#   command #1 and #2
    5252#
     53# Instead of the short-hand syntax "#1" also "ticket:1" can be used, e.g.:
     54#   command ticket:1
     55#   command ticket:1, ticket:2
     56#   command ticket:1 & ticket:2
     57#   command ticket:1 and ticket:2
     58#
    5359# You can have more then one command in a message. The following commands
    5460# are supported. There is more then one spelling for each command, to make
    5561# this as user-friendly as possible.
    5662#
    57 #   closes, fixes
     63#   close, closed, closes, fix, fixed, fixes
    5864#     The specified issue numbers are closed with the contents of this
    5965#     commit message being added to it.
    60 #   references, refs, addresses, re
     66#   references, refs, addresses, re, see
    6167#     The specified issue numbers are left in their current status, but
    6268#     the contents of this commit message are added to their notes.
    6369#
     
    118124    leftEnv = ''
    119125    rghtEnv = ''
    120126
    121 commandPattern = re.compile(leftEnv + r'(?P<action>[A-Za-z]*).?(?P<ticket>#[0-9]+(?:(?:[, &]*|[ ]?and[ ]?)#[0-9]+)*)' + rghtEnv)
    122 ticketPattern = re.compile(r'#([0-9]*)')
     127commandPattern = re.compile(leftEnv + r'(?P<action>[A-Za-z]*).?(?P<ticket>(?:#|ticket:)[0-9]+(?:(?:[, &]*|[ ]?and[ ]?)(?:#|ticket:)[0-9]+)*)' + rghtEnv)
     128ticketPattern = re.compile(r'(?:#|ticket:)([0-9]*)')
    123129
    124130class CommitHook:
    125131    _supported_cmds = {'close':      '_cmdClose',

comment:2 by Christian Boos, 18 years ago

Milestone: 0.10.50.11

Slightly modified patch applied in r5240 (see also r5241).

comment:3 by Christian Boos, 18 years ago

Resolution: fixed
Status: newclosed

Forgot to close this one yesterday.

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Jonas Borgström.
The resolution will be deleted. Next status will be 'reopened'.
to The owner will be changed from Jonas Borgström to the specified user.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.