trac-hacks / mantis2trac Goto Github PK
View Code? Open in Web Editor NEWa way to migrate mantis tickets and issues into Trac
a way to migrate mantis tickets and issues into Trac
During import on RHEL4
cleaning all tickets...
0. Finding project IDs...
Traceback (most recent call last):
File "./mantis2trac.py", line 943, in ?
main()
File "./mantis2trac.py", line 940, in main
convert(MANTIS_DB, MANTIS_HOST, MANTIS_USER, MANTIS_PASSWORD, TRAC_ENV, TRAC_CLEAN)
File "./mantis2trac.py", line 575, in convert
mysql_cur.execute(sql)
File "/usr/lib/python2.3/site-packages/MySQLdb/cursors.py", line 163, in execute
self.errorhandler(self, exc, value)
File "/usr/lib/python2.3/site-packages/MySQLdb/connections.py", line 35, in defaulterrorhandler
raise errorclass, errorvalue
UnicodeDecodeError: 'utf8' codec can't decode bytes in position 3-8: unsupported Unicode code range
Further information:
Mantis Version 1.0.7
Trac 0.10.4, MySQL Database
I have a mantis issue that i changed the reporter on as part of the history. The log messages complain that "The bug id, field name, and time must be unique", but that's not the problem.
The field in addTicketChange() is reporter_id. This sql is executed,
sql = "UPDATE ticket SET %s='%s' WHERE id=%s" % (field, newvalue, ticket)
but ticket doesn't have that column.
I'm guessing it's throwing some exception. Unfortunately convert is catching everything on line 813 (please fix).
A fix that worked for me is this code near line 781
elif field_name == 'reporter_id':
ticketChange['field'] = 'reporter'
I get this error
The bug id, field name, and time must be unique
But the real issue is table ticket doesn't have a column called url.
At first i tried to add this as a keyword change, but after some thought it feels more like a comment.
Send me some feedback, and i'll test it.
How import one project with mantis2trac.py script?
Is it necessary to put the project name in the products option?
This line was giving me an error.
return self.db().get_last_id(c,'ticket')
psycopg2.ProgrammingError: currval of sequence "ticket_id_seq" is not yet defined in this session
This seems utterly wrong to me since i can select currval('ticket_id_seq') via psql.
It's not used so i commented it out.
On a slightly different note, are the sequences in postgresql set correctly after all tickets, comments, stuff are inserted?
I am trying to run mantis2trac.py on a Mantis v1.1.8 server running under Mysql 5.x. It imports 40 tickets, than on ticket 41 it bombs out with:
Traceback (most recent call last):
File "./mantis2trac.py", line 943, in <module>
main()
File "./mantis2trac.py", line 940, in main
convert(MANTIS_DB, MANTIS_HOST, MANTIS_USER, MANTIS_PASSWORD, TRAC_ENV, TRAC_CLEAN)
File "./mantis2trac.py", line 680, in convert
trac.addTicket(**ticket)
File "./mantis2trac.py", line 386, in addTicket
desc = description.encode('utf-8')
UnicodeDecodeError: 'utf8' codec can't decode byte 0xa3 in position 244: unexpected code byte
I looked at ticket 41. It has the UK pound symbol (£) in it. How do I get the script to fix this properly? I'd like to import all of the tickets in but this is a really big showstopper.
Thanks!
a minor annoyance: an extra slash is required at the end of the trac env path, which isn't standard practice; the example given of /path/to/trac/env is wrong.
after fixing 1 above, running the script gets me all the way to step 2:
2. import components...
sql: SELECT category, user_id as owner FROM mantis_project_category_table WHERE project_id '3' or project_id '5' or project_id '7' or project_id '9' or project_id = '10'
Adding user hardy to sessions table
Traceback (most recent call last):
File "./mantis2trac.py", line 926, in ?
main()
File "./mantis2trac.py", line 923, in main
convert(MANTIS_DB, MANTIS_HOST, MANTIS_USER, MANTIS_PASSWORD, TRAC_ENV, TRAC_CLEAN)
File "./mantis2trac.py", line 578, in convert
component['owner'] = trac.getLoginName(mysql_cur, component['owner'])
File "./mantis2trac.py", line 467, in getLoginName
print 'could not insert %s into sessions table: sql error %s ' % loginName, self.db().error()
After some debugging, I discover that:
AttributeError: 'pysqlite2.dbapi2.Connection' object has no attribute 'error'
So I drop the fancy error reporting and just see what error Python will throw:
pysqlite2.dbapi2.OperationalError: near "IGNORE": syntax error
According the SQLite page, that is indeed incorrect syntax. Lines 462 and 470 should read "INSERT OR IGNORE" not "INSERT IGNORE".
So, after correcting these lines, I receive this error:
2. import components...
sql: SELECT category, user_id as owner FROM mantis_project_category_table WHERE project_id '3' or project_id '5' or project_id '7' or project_id '9' or project_id = '10'
Adding user hardy to sessions table
Traceback (most recent call last):
File "./mantis2trac.py", line 926, in ?
main()
File "./mantis2trac.py", line 923, in main
convert(MANTIS_DB, MANTIS_HOST, MANTIS_USER, MANTIS_PASSWORD, TRAC_ENV, TRAC_CLEAN)
File "./mantis2trac.py", line 578, in convert
component['owner'] = trac.getLoginName(mysql_cur, component['owner'])
File "./mantis2trac.py", line 474, in getLoginName
(result[0]['username'].encode('utf-8'), '1', 'name', result[0]['realname'].encode('utf-8'),
File "/usr/lib/python2.3/site-packages/trac/db/util.py", line 47, in execute
return self.cursor.execute(sql_escape_percent(sql), args)
File "/usr/lib/python2.3/site-packages/trac/db/sqlite_backend.py", line 56, in execute
args or [])
File "/usr/lib/python2.3/site-packages/trac/db/sqlite_backend.py", line 48, in _rollback_on_error
return function(self, *args, **kwargs)
pysqlite2.dbapi2.OperationalError: near ",": syntax error
And, unfortunately, my debug abilities have hit a wall. I'm not sure what might be the problem, so I'm throwing this out there, to see if anyone might be able to help.
Hi,
I'm an administrator for trac-hacks.org. We've created an organization on GitHub and are inviting authors of trac-hacks plugins to join the organization. Your repository could be transferred into the organization as described in the GitHub docs. You'd retain full control over the repository, but the hope is that it will be easier for users on GitHub to find trac-hacks plugins, such as yours, by viewing the trac-hacks organization. We also plan to eventually add search capabilities that aggregate the plugins available on trac-hacks.org and github.com/trac-hacks, to provide a single index of all plugins available for Trac.
In the future, if you choose to no longer maintain the plugin, the organization would be able to provide commit access to new developers. This would only be done with your permission, as has been the policy for plugins hosted on trac-hacks.org. If you've already decided to no longer maintain the plugin, we would particularly appreciate you transferring the plugin to the trac-hacks organization so that we can help find new maintainers for it.
Thank you for your consideration.
Kind regards,
Ryan
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.