Modify

Opened 14 years ago

Closed 12 years ago

Last modified 12 years ago

#7812 closed enhancement (fixed)

[PATCH] Handle references between imported tickets

Reported by: Chris Nelson Owned by: Chris Nelson
Priority: normal Component: TicketImportPlugin
Severity: normal Keywords: ticket dependency subtask wbs
Cc: Trac Release: 0.11

Description

This enhancement facilitates importing projects from Microsoft Project or similar programs by handling references to other tickets in the import such as dependencies and WBS (parent/child). Dependencies work well with the MasterTicket plugin. I know of no good support for parent/child tasks yet.

For example:

summary#blockedby#wbs
Design schematic1
Layout board12
Check board22.1
Manufacture prototypes2,32.2
Prototype verification43

Once imported, this list might become:

idsummaryblockedbywbs
3000Design schematic
3001Layout board3000
3003Check board30013001
3004Manufacture prototypes3001,30033001
3005Prototype verification3004

This is provided in several patches which first change some plugin code to facilitate the enhancement, then add dependency support, then add WBS support. Each patch depends on those before it but can be used without those after it.

Attachments (9)

typo.patch (605 bytes) - added by Chris.Nelson@… 14 years ago.
Fix a typo in a comment
modified_list.tgz (1.6 KB) - added by Chris.Nelson@… 14 years ago.
Keep a list of added, modified tickets, count at end.
form_reorg.patch (2.8 KB) - added by Chris.Nelson@… 14 years ago.
Move form to top of page. (Experienced users don't need the details every time.)
relative_tickets.patch (7.0 KB) - added by Chris.Nelson@… 14 years ago.
Handle relative ticket fields
wbs.tgz (2.0 KB) - added by Chris.Nelson@… 14 years ago.
Handle WBS numbers
all.tgz (4.5 KB) - added by Chris.Nelson@… 14 years ago.
Combined patch (all of the other changes in one file).
wbs.2.tgz (2.4 KB) - added by Chris.Nelson@… 14 years ago.
Improved WBS patch
all.2.tgz (4.6 KB) - added by Chris.Nelson@… 14 years ago.
Revised comprehensive patch (with new WBS changes)
all.3.tgz (3.8 KB) - added by François Granade 12 years ago.

Download all attachments as: .zip

Change History (27)

Changed 14 years ago by Chris.Nelson@…

Attachment: typo.patch added

Fix a typo in a comment

Changed 14 years ago by Chris.Nelson@…

Attachment: modified_list.tgz added

Keep a list of added, modified tickets, count at end.

Changed 14 years ago by Chris.Nelson@…

Attachment: form_reorg.patch added

Move form to top of page. (Experienced users don't need the details every time.)

Changed 14 years ago by Chris.Nelson@…

Attachment: relative_tickets.patch added

Handle relative ticket fields

Changed 14 years ago by Chris.Nelson@…

Attachment: wbs.tgz added

Handle WBS numbers

Changed 14 years ago by Chris.Nelson@…

Attachment: all.tgz added

Combined patch (all of the other changes in one file).

comment:1 Changed 14 years ago by Chris.Nelson@…

Sorry for the compressed tar files but when I tried to upload a couple of my patches, TH complained about "blacklisted patterns" in the text.

Changed 14 years ago by Chris.Nelson@…

Attachment: wbs.2.tgz added

Improved WBS patch

Changed 14 years ago by Chris.Nelson@…

Attachment: all.2.tgz added

Revised comprehensive patch (with new WBS changes)

comment:2 Changed 14 years ago by François Granade

Owner: changed from François Granade to Chris.Nelson@…

I'd love to take your patch ! however, could i ask you to add a few tests ?

It should be easy - see for example [9725] for fix that has a test...

If you want I can make you committer if it's easier for you.

comment:3 Changed 14 years ago by Adrian Fritz

Summary: Handle references between imported tickets[PATCH] Handle references between imported tickets

comment:4 in reply to:  2 Changed 14 years ago by Chris Nelson

Replying to farialima:

I'd love to take your patch ! however, could i ask you to add a few tests ?

It should be easy - see for example [9725] for fix that has a test...

I'll take a look at that and attach another patch if I figure it out.

If you want I can make you committer if it's easier for you.

comment:5 in reply to:  2 Changed 14 years ago by Chris Nelson

Replying to farialima:

I'd love to take your patch ! however, could i ask you to add a few tests ?

It should be easy - see for example [9725] for fix that has a test... ...

A CSV file is easy but I have no idea what the .ctl files are or how to generate them.

comment:6 Changed 14 years ago by François Granade

Hello Chris

the .ctl (control) file(s) are simply copies of the .out (output) file(s) generated by each test. The idea is: when you are happy with the output that you see when importing the file manually in your Trac instance, you just run the test(s) from the command line, and you rename or copy the .out file to .ctl, and then commit the .ctl. When rerunning the tests, the .ctl files will be compared with .out file generated, to ensure the result is the same.

Note that since the output aren't exactly the same on 0.11 and 0.12, there are two sets of control files: if possible at leat commit them for 0.11

Hope it helps

comment:7 Changed 13 years ago by Ryan J Ollos

Owner: changed from Chris.Nelson@… to Chris Nelson
Reporter: changed from Chris.Nelson@… to Chris Nelson

comment:8 Changed 12 years ago by falkb

Hi, could you please update the patch? The current SVN revision isn't patchable:

...
The text leading up to this was:
--------------------------
|diff --git a/0.11/talm_importer/importer.py b/0.11/talm_importer/importer.py
|index 6bcbdb9..e16d003 100644
|--- a/0.11/talm_importer/importer.py
|+++ b/0.11/talm_importer/importer.py
--------------------------
File to patch: talm_importer/importer.py
patching file talm_importer/importer.py
Hunk #1 succeeded at 203 (offset 12 lines).
Hunk #2 succeeded at 259 (offset 12 lines).
Hunk #3 succeeded at 325 (offset 17 lines).
Hunk #4 FAILED at 369.
1 out of 4 hunks FAILED -- saving rejects to file talm_importer/importer.py.rej
can't find file to patch at input line 71
Perhaps you used the wrong -p or --strip option?

...

patching file talm_importer/templates/importer.html
Hunk #1 succeeded at 31 with fuzz 2.
Hunk #3 FAILED at 110.
1 out of 3 hunks FAILED -- saving rejects to file talm_importer/templates/import
er.html.rej
...

comment:9 Changed 12 years ago by François Granade

Patch updated in all.3.tgz -- should work now on the 0.11 branch (which also works on 0.12).

Chris, as soon as you have a little bit of tests on this, I'll be glad to apply the patch.

Changed 12 years ago by François Granade

Attachment: all.3.tgz added

comment:10 Changed 12 years ago by François Granade

Resolution: fixed
Status: newclosed

Actually, I ended up applying the patch to the 0.11 branch - in [11745]. It may not work 100% correctly but it's not breaking anything. Marking this as fixed, even though I'd glad to have tests...

comment:11 Changed 12 years ago by falkb

Thanks a lot, gonna test it on Monday

comment:12 Changed 12 years ago by falkb

Nope, doesn't work:

KeyError: u'#blockedby'

callstack is:

Datei "build/bdist.win32/egg/trac/web/main.py", Zeile 511, in _dispatch_request
  dispatcher.dispatch(req)
Datei "build/bdist.win32/egg/trac/web/main.py", Zeile 237, in dispatch
  resp = chosen_handler.process_request(req)
Datei "build/bdist.win32/egg/talm_importer/importer.py", Zeile 78, in process_request
  encoding=req.session['importer.encoding'])
Datei "build/bdist.win32/egg/talm_importer/importer.py", Zeile 122, in _do_preview
  return self._process(filereader, get_reporter_id(req), PreviewProcessor(self.env, req))
Datei "build/bdist.win32/egg/talm_importer/importer.py", Zeile 389, in _process
  relativeticketvalues.append(dict([(f, row['#'+f]) for f in relativeticketfields]))

comment:13 Changed 12 years ago by falkb

it seems it's because the .xls file uses '#BlockedBy' instead of '#blockedby' ...although the docs say it shouldn't matter.

comment:14 in reply to:  13 ; Changed 12 years ago by François Granade

Replying to falkb:

it seems it's because the .xls file uses '#BlockedBy' instead of '#blockedby' ...although the docs say it shouldn't matter.

I can't find where it's written in the doc, could you point me to it ? I doesn't seem easy to fix in the code, so I'd rather fix the docs...

comment:15 in reply to:  14 ; Changed 12 years ago by falkb

Replying to farialima:

I can't find where it's written in the doc, could you point me to it ? I doesn't seem easy to fix in the code, so I'd rather fix the docs...

I asked the user and it turns out he has read it on the web page displayed when one clicks on mainnav menu item "Import". The text says:

"...The fields must be Trac fields. The valid fields for this Trac instance are: ticket or id, summary, reporter, ...snip... , blockedby, blocking, ...snip... and . Field names are case-insensitive: 'summary', 'Summary', 'SUMMARY' refer to the same field. ..."

comment:16 in reply to:  15 Changed 12 years ago by Chris Nelson

Replying to falkb:

Replying to farialima:

I can't find where it's written in the doc, could you point me to it ? I doesn't seem easy to fix in the code, so I'd rather fix the docs...

I asked the user and it turns out he has read it on the web page displayed when one clicks on mainnav menu item "Import". The text says:

"...The fields must be Trac fields. The valid fields for this Trac instance are: ticket or id, summary, reporter, ...snip... , blockedby, blocking, ...snip... and . Field names are case-insensitive: 'summary', 'Summary', 'SUMMARY' refer to the same field. ..."

It seems likely that the main plugin downcases field names and my patch fails to.

comment:17 Changed 12 years ago by François Granade

Actually, I ended up fixing this issue with the case - in [11758] - now things should work correctly no matter the case of the field name.

comment:18 Changed 12 years ago by falkb

Cool, the preview says everything is OK now, though due other reasons we haven't completed the import yet. Gonna report the result as soon as done...

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Chris Nelson.
The resolution will be deleted. Next status will be 'reopened'.

Add Comment


E-mail address and name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.