Changes between Initial Version and Version 1 of Ticket #9940
- Timestamp:
- Dec 21, 2010, 1:40:42 PM (13 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Ticket #9940
- Property Milestone → unscheduled
- Property Reporter changed from to
-
Ticket #9940 – Description
initial v1 1 When trying to use bugzilla2trac.py mentioned in 2 http://trac.edgewall.org/wiki/TracImport I ran 3 into the problem that (admin / firewall wise) it 4 was not possible to give the TRAC server direct 5 access and suitable drivers for the PostgreSQL 6 database of the source Bugzilla instance. 1 When trying to use bugzilla2trac.py mentioned in http://trac.edgewall.org/wiki/TracImport I ran into the problem that (admin / firewall wise) it was not possible to give the TRAC server direct access and suitable drivers for the PostgreSQL database of the source Bugzilla instance. 7 2 8 Because of this, I wrote a script which converts 9 the XML output of the Bugzilla search result web 10 page into CSV suitable for the csv2trac.2.py 11 script. An example of the search results is on: 3 Because of this, I wrote a script which converts the XML output of the Bugzilla search result web page into CSV suitable for the csv2trac.2.py script. An example of the search results is on: 12 4 13 5 https://landfill.bugzilla.org/bugzilla-tip/buglist.cgi?query_format=specific&order=relevance+desc&bug_status=__open__&product=&content=broken 14 6 15 At the bottom, you see a link CSV (which only 16 returns columns like the bug titles) and a 17 button XML. The XML button returns the full 18 content of all bugs in the result list. Note 19 that attached files are not included in this. 7 At the bottom, you see a link CSV (which only returns columns like the bug titles) and a button XML. The XML button returns the full content of all bugs in the result list. Note that attached files are not included in this. 20 8 21 To find all bugs, just use all states as the 22 search constraint. If simple search does not 23 let you search without search terms, you can 24 use advanced search. It is also configurable 25 by Bugzilla admins whether trivial searches 26 are allowed. Yet even at strict settings, it 27 is possible to search "all states, no term". 9 To find all bugs, just use all states as the search constraint. If simple search does not let you search without search terms, you can use advanced search. It is also configurable by Bugzilla admins whether trivial searches are allowed. Yet even at strict settings, it is possible to search "all states, no term". 28 10 29 11 ---- 30 12 31 To convert the Bugzilla XML data to CSV for 32 csv2trac usage, I wrote a small Perl script. 33 At least compared to bugzilla2trac, it is 34 quite small. The script can be put under any 35 free open source license of your choice. It 36 can even be put into the public domain... 13 To convert the Bugzilla XML data to CSV for csv2trac usage, I wrote a small Perl script. At least compared to bugzilla2trac, it is quite small. The script can be put under any free open source license of your choice. It can even be put into the public domain... 37 14 38 15 Dependency import lines of the Perl script are: … … 48 25 Those extra modules are small: light dependencies. 49 26 50 To run the script, put your XML into bugs.xml and 51 receive your CSV as bugs.csv - do not forget to 52 read or store the output. It will give you a list 53 of all converted bugs and all attachments. 27 To run the script, put your XML into bugs.xml and receive your CSV as bugs.csv - do not forget to read or store the output. It will give you a list of all converted bugs and all attachments. 54 28 55 Note that you have to copy attachments manually: 56 The XML does not contain them and csv2trac does 57 not handle them either. If you want to script a 58 download of attachments from Bugzilla, they all 59 have download URLs in the style of 60 yourbugzilla.example.com/dir/attachment.cgi?id=N 61 where N is their attachment number / ID value. 29 Note that you have to copy attachments manually: The XML does not contain them and csv2trac does not handle them either. If you want to script a download of attachments from Bugzilla, they all have download URLs in the style of yourbugzilla.example.com/dir/attachment.cgi?id=N where N is their attachment number / ID value. 62 30 63 31 ---- 64 32 65 The script combines all posts about one bug into 66 one string for TRAC usage. Wiki markup keeps the 67 posts in original layout, with headings about 68 the who and when of the posts. Attachment meta 69 data is also added there, using Wiki markup, as 70 is information about duplicate-of, blocked-by 71 and depends-on bug bug relations. 33 The script combines all posts about one bug into one string for TRAC usage. Wiki markup keeps the posts in original layout, with headings about the who and when of the posts. Attachment meta data is also added there, using Wiki markup, as is information about duplicate-of, blocked-by and depends-on bug bug relations. 72 34 73 Bugs are normally converted to defects, but if 74 the severity is enhancement, they are converted 75 as enhancements. The type called task is never 76 used by the current version of the script. 35 Bugs are normally converted to defects, but if the severity is enhancement, they are converted as enhancements. The type called task is never used by the current version of the script. 77 36 78 The isobsolete, ispatch and isprivate flags of 79 Bugzilla attachments and the global properties 80 of maintainer, urlbase and version of Bugzilla 81 itself are not converted (although the latter 82 three are logged to standard output). The name 83 attribute of users is also not converted, the 84 script copies the user name / email instead. 37 The isobsolete, ispatch and isprivate flags of Bugzilla attachments and the global properties of maintainer, urlbase and version of Bugzilla itself are not converted (although the latter three are logged to standard output). The name attribute of users is also not converted, the script copies the user name / email instead. 85 38 86 The Bugzilla bug number is used as start of 87 the bug title (e.g. "bug 42: internet broken") 88 because TRAC has to use other ticket numbers. 39 The Bugzilla bug number is used as start of the bug title (e.g. "bug 42: internet broken") because TRAC has to use other ticket numbers. 89 40 90 The versions unspecified and svn HEAD are not 91 copied and the milestones --- and *unspecified* 92 are not copied. They are converted into empty 93 strings. The component field is converted as 94 keywords like Component_examplecomponent but 95 the value core is not converted. 41 The versions unspecified and svn HEAD are not copied and the milestones --- and *unspecified* are not copied. They are converted into empty strings. The component field is converted as keywords like Component_examplecomponent but the value core is not converted. 96 42 97 The flags reporter_accessible, cclist_accessible, 98 classification and ..._id and everconfirmed are 99 not converted. 43 The flags reporter_accessible, cclist_accessible, classification and ..._id and everconfirmed are not converted. 100 44 101 The rep_platform is converted as a keyword like 102 Reporter_Macintosh unless the value was All. 103 The op_sys is converted as keyword as well, e.g. 104 OS_Linux, unless the value was originally All. 45 The rep_platform is converted as a keyword like Reporter_Macintosh unless the value was All. The op_sys is converted as keyword as well, e.g. OS_Linux, unless the value was originally All. 105 46 106 Resolutions FIXED, INVALID, WONTFIX, DUPLICATE 107 and WORKSFORME are converted to lower case to 108 fit into TRAC syntax. Open bugs have the empty 109 string as resolution state. Also, states as 110 NEW, ASSIGNED, REOPENED, CLOSED and RESOLVED 111 are converted to lower case for TRAC and the 112 value RESOLVED is replaced by closed for TRAC. 47 Resolutions FIXED, INVALID, WONTFIX, DUPLICATE and WORKSFORME are converted to lower case to fit into TRAC syntax. Open bugs have the empty string as resolution state. Also, states as NEW, ASSIGNED, REOPENED, CLOSED and RESOLVED are converted to lower case for TRAC and the value RESOLVED is replaced by closed for TRAC. 113 48 114 Priorities P1 to P5 are mapped to TRAC strings 115 highest, high, normal, low, lowest respectively. 116 Severities blocker, critical, major, normal, 117 minor, trivial and enhancement are copied as 118 is, but if severity is enhancement then the 119 type enhancement is used instead of defect. 49 Priorities P1 to P5 are mapped to TRAC strings highest, high, normal, low, lowest respectively. Severities blocker, critical, major, normal, minor, trivial and enhancement are copied as is, but if severity is enhancement then the type enhancement is used instead of defect. 120 50 121 51 ---- … … 135 65 ---- 136 66 137 It turned out to be necessary to update csv2trac.2.py 138 to process even bugs with special characters in their 139 discussion or title, so I also provide a patch for the 140 csv2trac script. In short, the original 67 It turned out to be necessary to update csv2trac.2.py to process even bugs with special characters in their discussion or title, so I also provide a patch for the csv2trac script. In short, the original 141 68 142 69 {{{ … … 144 71 }}} 145 72 146 style syntax was using values inline, causing SQL 147 injection style problems. The patched script uses 73 style syntax was using values inline, causing SQL injection style problems. The patched script uses 148 74 149 75 {{{ … … 159 85 }}} 160 86 161 at one place to allow non-ASCII chars in the content. 162 Be aware that other fields do not use decode yet, so 163 e.g. component names or version numbers still have to 164 be plain ASCII even with my patch applied to csv2trac. 165 87 at one place to allow non-ASCII chars in the content. Be aware that other fields do not use decode yet, so e.g. component names or version numbers still have to be plain ASCII even with my patch applied to csv2trac.