Modify

Opened 14 months ago

Closed 14 months ago

Last modified 14 months 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

Description

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:

  • web_ui.py

     
    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
    3031
    3132gettext, _, tag_, N_, add_domain = \
    3233    domain_functions('ticketlog', 'gettext', '_', 'tag_', 'N_', 'add_domain')
     
    154155
    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))
    163171
    164172    def _get_ticket_revisions(self, req, ticket_id):
    165173        revisions = []

Attachments (1)

web_ui.py.diff (1.5 KB) - added by Rochi 14 months ago.
Patch

Download all attachments as: .zip

Change History (5)

Changed 14 months ago by Rochi

Attachment: web_ui.py.diff added

Patch

comment:1 Changed 14 months ago by figaro

Keywords: patch added

comment:2 Changed 14 months ago by Ryan J Ollos

Status: newaccepted

comment:3 Changed 14 months 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 14 months ago by Rochi

Thx for fixing.

Modify Ticket

Change Properties
Set your email in Preferences
Action
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.