Edgewall Software

Opened 6 years ago

Last modified 4 years ago

#10681 new defect

commit_updater.py create wrong comment number

Reported by: haterw@… Owned by:
Priority: normal Milestone: undecided
Component: ticket system Version: 0.12.2
Severity: normal Keywords:
Release Notes:
API Changes:


How to reproduce

  1. create new ticket A,B
  2. add a comment in ticket B
  3. commit message like below TWICE in hg
    refs #B
    refs #A
    test commit updater

Expect result
Ticket A will have comment 1,2
Ticket B will have comment 1,2,3

In fact we get
Ticket A has comment 1,2
Ticket B has comment number 1,2,2

Attachments (0)

Change History (5)

comment:1 Changed 6 years ago by Christian Boos

Milestone: undecided

All the tickets for {20} from last year have probably been seen multiple times by now, yet are still to be triaged…

comment:2 Changed 5 years ago by marthein1@…

I have observed the same problem on our local trac site used for SVN. Additionally, I observed that when 3 tickets are referenced in a commit comment, the comment number on the first ticket is correct, the one in the second ticket is equal to the previous number, and the one in the third ticket is one less than the previous number.

After observing commit_updater.py, I think the problem is in ticket.save_changes() and is the problem reported in #10465.

comment:3 Changed 5 years ago by marthein1@…

I forgot to mention we use trac 0.12.

comment:4 Changed 5 years ago by Remy Blank

Could you be more explicit about what is wrong in save_changes()? commit_updater.py uses separate Ticket instances for the various tickets it updates, so it's not obvious why the comment number would somehow persist across instances.

comment:5 Changed 4 years ago by anonymous

As already talked in other tickets, the query to get current comment number (in ticket.save_changes()) was buggy, and seems to be the cause of this bug.

  • comment:14:ticket:8947

    If there are two transactions with the same timestamp but affecting different tickets, would this not be liable to return the comment values for all of the tickets? This in turn could result in the cnum being pulled from the incorrect ticket.

  • comment:3:ticket:10465

    Referenced ticket comments have the same time as the changeset, so that causes problems.

r10630 have fixed this bug in our environment.

Modify Ticket

Change Properties
Set your email in Preferences
as new The ticket will remain with no owner.
The ticket will be disowned.
as The resolution will be set.
The owner will be changed from (none) to anonymous.

Add Comment

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