Edgewall Software
Modify

Opened 17 years ago

Closed 17 years ago

Last modified 16 years ago

#1462 closed defect (fixed)

bugzilla2trac.py improvements

Reported by: Florent Guillaume <fg@…> Owned by: Jonas Borgström
Priority: normal Milestone: 0.9
Component: general Version: devel
Severity: normal Keywords: bugzilla
Cc: Branch:
Release Notes:
API Changes:
Internal Changes:

Description

Here are some improvements to bugzilla2trac.py that were useful for my conversion. Read the top of the file for details, highlights are:

  • you can now choose to import the Bugzilla products as Trac components, which also puts the Bugzilla components in the Trac keywords,
  • remapping of bugzilla identifiers to different Trac usernames,
  • remapping of keywords,
  • conversion of inline bug numbers to TracLinks,
  • ignoring of certain milestones,
  • in general more flexibility in the configuration.

Attachments (6)

bugzilla2trac.py.diff (19.2 KB ) - added by Florent Guillaume <fg@…> 17 years ago.
bugzilla2trac.py.2.diff (356 bytes ) - added by asmodai@… 17 years ago.
Fix for not honouring top-of-file settings
bugzilla2trac.py.3.diff (558 bytes ) - added by Jeroen Ruigrok <asmodai@…> 17 years ago.
trac.env does not have get_attachments_dir anymore, rework the code
bugzilla2trac.py.4.diff (22.2 KB ) - added by charlie.clark@… 17 years ago.
This should be applied directly to trunk, not on top off the existing diffs
bugzilla2trac.py.5.diff (3.6 KB ) - added by eburghar@… 17 years ago.
support for bugzilla 2.18.1 (#1972)
bugzilla2trac.py.6.diff (43.6 KB ) - added by asmodai@… 17 years ago.
Continue building on Guillaume's work and support BZ 2.1[89] as well as PySQLite2

Download all attachments as: .zip

Change History (14)

by Florent Guillaume <fg@…>, 17 years ago

Attachment: bugzilla2trac.py.diff added

comment:1 by Florent Guillaume <fg@…>, 17 years ago

This is a diff from the trunk, by the way. But it also works with 0.8.1.

by asmodai@…, 17 years ago

Attachment: bugzilla2trac.py.2.diff added

Fix for not honouring top-of-file settings

comment:2 by Jeroen Ruigrok <asmodai@…>, 17 years ago

Milestone: 0.9

The patch I added solves the fact that if you modify the in-script settings at the top and running the script it will just print usage(). Which goes against EITHER specifying with command line or with in-script settings.

by Jeroen Ruigrok <asmodai@…>, 17 years ago

Attachment: bugzilla2trac.py.3.diff added

trac.env does not have get_attachments_dir anymore, rework the code

comment:3 by charlie.clark@…, 17 years ago

Patch 3 only affects convert, addAttachment still calls .create_attachment

comment:4 by anonymous, 17 years ago

Component: ticket systemgeneral
Version: 0.8.1devel

If I understand things correctly, for trunk / 0.9 there is a problem with attachments. The solution I think is to use attachment.Attachment in convert tracAttachment = attachment.Attachment(trac.env, 'ticket', str(abug_id), None, trac.db()) tracAttachment.insert(afilename, StringIO.StringIO(athedata.tostring()), len(athedata))

First instantiate an Attachment but do not pass it a file immediately. Add the attachment by calling .insert() on the attachment instance.

I will try and post the diff.

by charlie.clark@…, 17 years ago

Attachment: bugzilla2trac.py.4.diff added

This should be applied directly to trunk, not on top off the existing diffs

comment:5 by charlie.clark@…, 17 years ago

If you want to import users into the Trac DB then you can extend the convert function. Adjust as necessary but designed to work with my RelationalRoleSupportPatch http://trac-hacks.swapoff.org/wiki/RelationalRoleSupportPatch #import users mysql_cur.execute("SELECT login_name, cryptpassword FROM profiles") users = mysql_cur.fetchall() c.execute("DELETE FROM trac_users") c.executemany("INSERT INTO trac_users (username, password) VALUES (%s, %s)",

[(userlogin_name, usercryptpassword) for user in users])

by eburghar@…, 17 years ago

Attachment: bugzilla2trac.py.5.diff added

support for bugzilla 2.18.1 (#1972)

comment:6 by anonymous, 17 years ago

  1. import severities…

inserting severity blocker 1 Traceback (most recent call last):

File "bugzilla2trac.py", line 681, in ?

main()

File "bugzilla2trac.py", line 678, in main

convert(BZ_DB, BZ_HOST, BZ_USER, BZ_PASSWORD, TRAC_ENV, TRAC_CLEAN)

File "bugzilla2trac.py", line 381, in convert

trac.setSeverityList(severities)

File "bugzilla2trac.py", line 166, in setSeverityList

"severity", value.encode('utf-8'), i)

TypeError: execute() takes at most 3 arguments (5 given)

is the error I get. cmlenz tells me it's due to the DB API not tweaked for pysqlite2.

Thanks,

(Seemant)

by asmodai@…, 17 years ago

Attachment: bugzilla2trac.py.6.diff added

Continue building on Guillaume's work and support BZ 2.1[89] as well as PySQLite2

comment:7 by asmodai@…, 17 years ago

This patchset also solves Seemant's problem.

comment:8 by Christopher Lenz, 17 years ago

Resolution: fixed
Status: newclosed

Last patch checked in in [2286]. Thanks!

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Jonas Borgström.
The resolution will be deleted. Next status will be 'reopened'.
to The owner will be changed from Jonas Borgström to the specified user.

Add Comment


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