Edgewall Software
Modify

Opened 15 years ago

Closed 15 years ago

Last modified 13 years ago

#1195 closed defect (fixed)

Post commit script failing with extra ticket numbers in log

Reported by: bhv1@… Owned by: Jonas Borgström
Priority: normal Milestone: 0.8.1
Component: general Version: 0.8
Severity: normal Keywords:
Cc: Branch:
Release Notes:
API Changes:

Description

With the trac-post-commit-script in trac 0.8, if a user places a ticket number in the commit message without a known command preceeding it, all command/ticket combinations are ignored due to the rollback. The following patch fixes this by checking for the command before trying to use it. This allows the rollback to still occur for unknown exceptions.

--- /home/bhv1/trac-0.8/contrib/trac-post-commit-hook   2004-09-12 14:59:27.000000000 -0400
+++ /var/svn/private/trac-post-commit-hook      2005-02-09 16:52:10.000000000 -0500
@@ -123,7 +123,8 @@
         cmdGroups = commandPattern.findall(msg) 
         for cmd, tkts in cmdGroups:
             try:
-                getattr(self, CommitHook._supported_cmds[cmd.lower()])(ticketPattern.findall(tkts))
+                if CommitHook._supported_cmds.has_key(cmd.lower()):
+                    getattr(self, CommitHook._supported_cmds[cmd.lower()])(ticketPattern.findall(tkts))
             except: 
                 self.con.rollback()
         self.con.commit()

Attachments (0)

Change History (2)

comment:1 by Christopher Lenz, 15 years ago

Milestone: 0.8.1

Looks like a low-risk change, so we could put it in 0.8.1.

comment:2 by Christopher Lenz, 15 years ago

Resolution: fixed
Status: newclosed

Patch applied in [1246], ported to 0.8 stable in [1247].

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 as closed 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.