Opened 6 years ago

Closed 6 years ago

Last modified 6 years ago

#13461 closed defect (fixed)

ticketlog sync :: DataError: (1264, "Out of range value for column 'ticket' at row 1")

Reported by: Rochi Owned by: Ryan J Ollos
Priority: normal Component: TracTicketChangelogPlugin
Severity: normal Keywords: patch
Cc: Trac Release: 1.2


There is a bug if I run:

trac-admin $env ticketlog sync

DataError: (1264, "Out of range value for column 'ticket' at row 1")

This is because the ticket number sometimes matches invalid numbers.

I fixed it with:


    2727from trac.util.text import shorten_line
    2828from trac.util.translation import domain_functions
    2929from tracopt.ticket.commit_updater import CommitTicketUpdater
     30from trac.util.text import exception_to_unicode
    3132gettext, _, tag_, N_, add_domain = \
    3233    domain_functions('ticketlog', 'gettext', '_', 'tag_', 'N_', 'add_domain')
    155156    def _insert_revision(self, rid, rev, message):
    156157        tickets = self._parse_message(message)
    157         with self.env.db_transaction as db:
    158             for tid in tickets:
    159                 db("""
    160                     INSERT INTO ticket_revision (ticket,repos,rev)
    161                     VALUES (%s,%s,%s)
    162                     """, (tid, rid, rev))
     158        try:
     159            with self.env.db_transaction as db:
     160                for tid in tickets:
     161                    if tid <= 2147483647:
     162                        db("""
     163                            INSERT INTO ticket_revision (ticket,repos,rev)
     164                            VALUES (%s,%s,%s)
     165                            """, (tid, rid, rev))
     166                    else:
     167                        self.log.error("ticketlog::sync:Ticket #%s is not a valid ticket number!", tid)
     168        except Exception as e:
     169            self.log.error("Unexpected error while processing ticket "
     170                           "#%s: %s", tid, exception_to_unicode(e))
    164172    def _get_ticket_revisions(self, req, ticket_id):
    165173        revisions = []

Attachments (1) (1.5 KB) - added by Rochi 6 years ago.

Download all attachments as: .zip

Change History (5)

Changed 6 years ago by Rochi

Attachment: added


comment:1 Changed 6 years ago by figaro

Keywords: patch added

comment:2 Changed 6 years ago by Ryan J Ollos

Status: newaccepted

comment:3 Changed 6 years ago by Ryan J Ollos

Resolution: fixed
Status: acceptedclosed

In 17251:

TracTicketChangelog 1.2.0dev: Don't fail on exception when syncing the repository

Fixes #13461.

comment:4 Changed 6 years ago by Rochi

Thx for fixing.

Modify Ticket

Change Properties
Set your email in Preferences
as closed The owner will remain Ryan J Ollos.
The resolution will be deleted. Next status will be 'reopened'.

Add Comment

E-mail address and name can be saved in the Preferences.

Note: See TracTickets for help on using tickets.