[Pkg-trac-devel] Bug#444052: please update sourceforge2trac.py
Romain Beauxis
toots at rastageeks.org
Tue Sep 25 18:48:58 UTC 2007
Package: trac
Version: 0.10.3-1etch2
Severity: normal
Tags: patch
Hi !
current sourceforge2trac.py does not work with shipped trac release.
You should consider patching it to make it work again..
See:
http://trac.edgewall.org/attachment/ticket/3521
Romain
-- System Information:
Debian Release: 4.0
APT prefers stable
APT policy: (500, 'stable')
Architecture: i386 (i686)
Shell: /bin/sh linked to /bin/bash
Kernel: Linux 2.6.18-5-686
Locale: LANG=fr_FR, LC_CTYPE=fr_FR (charmap=ISO-8859-1)
Versions of packages trac depends on:
ii python 2.4.4-2 An interactive high-level object-o
ii python-clearsilver 0.10.3-4.1 python bindings for clearsilver
ii python-pysqlite2 2.3.2-2 python interface to SQLite 3
ii python-subversion 1.4.2dfsg1-2 Python bindings for Subversion
ii python-support 0.5.6 automated rebuilding support for p
ii subversion 1.4.2dfsg1-2 Advanced version control system
Versions of packages trac recommends:
ii apache2 2.2.3-4+etch1 Next generation, scalable, extenda
ii apache2-mpm-prefork [httpd 2.2.3-4+etch1 Traditional model for Apache HTTPD
ii python-setuptools 0.6c3-3 Python Distutils Enhancements
-- no debconf information
-------------- next part --------------
Index: contrib/sourceforge2trac.py
===================================================================
--- contrib/sourceforge2trac.py (revision 3592)
+++ contrib/sourceforge2trac.py (working copy)
@@ -19,7 +19,7 @@
def __init__(self, e):
for field in e:
if field.get('name').endswith('date'):
- setattr(self, field.get('name'), datetime.fromtimestamp(int(field.text)))
+ setattr(self, field.get('name'), field.text)
else:
setattr(self, field.get('name'), field.text)
@@ -133,12 +133,10 @@
raise Exception("Will not modify database with existing tickets!")
c = self.db().cursor()
- c.execute("""DELETE FROM enum WHERE kind='ticket_type'""")
+ c.execute("""DELETE FROM enum WHERE type='ticket_type'""")
for i, value in enumerate(s):
- c.execute("""INSERT INTO enum (kind, name, value) VALUES (%s, %s, %s)""",
- "ticket_type",
- value,
- i)
+ c.execute("""INSERT INTO enum (type, name, value) VALUES (%s, %s, %s)""",
+ ("ticket_type", value, i))
self.db().commit()
def setPriorityList(self, s):
@@ -147,12 +145,10 @@
raise Exception("Will not modify database with existing tickets!")
c = self.db().cursor()
- c.execute("""DELETE FROM enum WHERE kind='priority'""")
+ c.execute("""DELETE FROM enum WHERE type='priority'""")
for i, value in enumerate(s):
- c.execute("""INSERT INTO enum (kind, name, value) VALUES (%s, %s, %s)""",
- "priority",
- value,
- i)
+ c.execute("""INSERT INTO enum (type, name, value) VALUES (%s, %s, %s)""",
+ ("priority", value, i))
self.db().commit()
@@ -165,7 +161,7 @@
c.execute("""DELETE FROM component""")
for value in l:
c.execute("""INSERT INTO component (name) VALUES (%s)""",
- value)
+ (value, ))
self.db().commit()
def setVersionList(self, v):
@@ -177,7 +173,7 @@
c.execute("""DELETE FROM version""")
for value in v:
c.execute("""INSERT INTO version (name) VALUES (%s)""",
- value)
+ (value, ))
self.db().commit()
def setMilestoneList(self, m):
@@ -189,7 +185,7 @@
c.execute("""DELETE FROM milestone""")
for value in m:
c.execute("""INSERT INTO milestone (name) VALUES (%s)""",
- value)
+ (value, ))
self.db().commit()
def addTicket(self, type, time, changetime, component,
@@ -202,6 +198,8 @@
status = 'assigned'
else:
status = 'new'
+ if len(changetime) == 0:
+ changetime = 0
c.execute("""INSERT INTO ticket (type, time, changetime, component,
priority, owner, reporter, cc,
@@ -211,25 +209,28 @@
%s, %s, %s, %s, %s,
%s, %s, %s, %s,
%s, %s, %s)""",
- type, time, changetime, component,
+ (type, time, changetime, component,
priority, owner, reporter, cc,
version, milestone, status.lower(), resolution,
- summary, '{{{\n%s\n}}}' % (description, ), keywords)
+ summary, '{{{\n%s\n}}}' % (description, ), keywords))
self.db().commit()
- return self.db().db.sqlite_last_insert_rowid()
+ return self.db().get_last_id(c, "ticket")
def addTicketComment(self, ticket, time, author, value):
c = self.db().cursor()
+ # uncomment this if you're hitting conflicts, I don't have the time to
+ # make this automatically fix things.
+ #print "Ticket=", ticket, ", time=", time, ", author=", author
c.execute("""INSERT INTO ticket_change (ticket, time, author, field, oldvalue, newvalue)
VALUES (%s, %s, %s, %s, %s, %s)""",
- ticket, time.strftime('%s'), author, 'comment', '', '{{{\n%s\n}}}' % (value, ))
+ (ticket, time, author, 'comment', '', '{{{\n%s\n}}}' % (value, )))
self.db().commit()
def addTicketChange(self, ticket, time, author, field, oldvalue, newvalue):
c = self.db().cursor()
c.execute("""INSERT INTO ticket_change (ticket, time, author, field, oldvalue, newvalue)
VALUES (%s, %s, %s, %s, %s, %s)""",
- ticket, time.strftime('%s'), author, field, oldvalue, newvalue)
+ (ticket, time, author, field, oldvalue, newvalue))
self.db().commit()
More information about the Pkg-trac-devel
mailing list