Opened 16 years ago
Closed 16 years ago
#8566 closed defect (fixed)
bugzilla2trac.py: Components / Versions from too many bugzilla products get imported
| Reported by: | Owned by: | Remy Blank | |
|---|---|---|---|
| Priority: | normal | Milestone: | 0.12 |
| Component: | ticket system | Version: | 0.12dev |
| Severity: | normal | Keywords: | bugzilla2trac |
| Cc: | remke.rutgers@… | Branch: | |
| Release Notes: | |||
| API Changes: | |||
| Internal Changes: | |||
Description
Selecting multiple PRODUCTS and COMPONENTS_FROM_PRODUCTS = False converts too many components from Bugzilla to Trac.
Software versions I use:
- Python: 2.3.4
- Bugzilla: 3.0.2
- Mysql: 4.0.18
- Trac: 0.10.4
- bugzilla2trac.py: revision 8272
- MySQL-python: 1.2.1_p2
My setup (partial):
COMPONENTS_FROM_PRODUCTS = False PRODUCTS = ["Product1","Product2","Product3"]
This results in the conversion of too many components: also components NOT belonging to Product1, Product2 or Product3 get imported.
By printing the select clause for components (line 570) I found out the issue is with the generated where clause for components: line 574:
sql += makeWhereClause('p.name', PRODUCTS)
This results in a where clause in the following form
p.name = 'Product1' or p.name = 'Product2' or p.name = 'Product3'
However, there are not parentheses around this where clause, which results in too many components getting selected.
I think any where clause generated by makeWhereClause(…) should result in a where clause surrounded by parentheses.
I fixed the problem by modifying line 498 in the makeWhereClause function: from
return ' ' + clause
to
return ' (' + clause + ') '
Can someone please review this change and (if accepted) apply it to bugzilla2trac.py?
Attachments (1)
Change History (6)
comment:1 by , 16 years ago
| Summary: | bugzilla2trac.py: Components from too many bugzilla products get imported → bugzilla2trac.py: Components / Versions from too many bugzilla products get imported |
|---|
by , 16 years ago
| Attachment: | 8566-bugzilla2trac-r8702.patch added |
|---|
Untested patch fixing both issues.
comment:2 by , 16 years ago
| Owner: | set to |
|---|
The patch above should fix both issues. Unfortunately, I have no way of testing it. I will apply it for 0.12 if I get some positive reports that it works and fixes the two issues discussed here.
comment:3 by , 16 years ago
I applied the patch and re-ran the import: I can confirm the components issue is fixed. I cannot say anything about the versions, because we are not using versions.
comment:4 by , 16 years ago
Thanks for the feedback! I'll wait a few more days and see if I can get a reply from hieroglyph as well.



I found the same problem and answer today, now I find that the same also applies to the imported version labels. I had to change the existing SQL:
sql = """SELECT DISTINCTROW versions.value AS value FROM products, versions""" sql += " WHERE" + makeWhereClause('products.name', PRODUCTS)…to
sql = """SELECT DISTINCTROW v.value AS value FROM products p, versions v WHERE v.product_id = p.id AND (""" sql += makeWhereClause('p.name', PRODUCTS) + ")"Note: I am wrapping the
makeWhereClausein brackets in the sql instead of inside the function as op suggested (I cannot see a problem with either approach?) but this does not solve the version label problem by itself.