Modify

Opened 4 years ago

Closed 2 years ago

Last modified 2 years ago

#7812 closed enhancement (fixed)

[PATCH] Handle references between imported tickets

Reported by: ChrisNelson Owned by: ChrisNelson
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@… 4 years ago.
Fix a typo in a comment
modified_list.tgz (1.6 KB) - added by Chris.Nelson@… 4 years ago.
Keep a list of added, modified tickets, count at end.
form_reorg.patch (2.8 KB) - added by Chris.Nelson@… 4 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@… 4 years ago.
Handle relative ticket fields
wbs.tgz (2.0 KB) - added by Chris.Nelson@… 4 years ago.
Handle WBS numbers
all.tgz (4.5 KB) - added by Chris.Nelson@… 4 years ago.
Combined patch (all of the other changes in one file).
wbs.2.tgz (2.4 KB) - added by Chris.Nelson@… 4 years ago.
Improved WBS patch
all.2.tgz (4.6 KB) - added by Chris.Nelson@… 4 years ago.
Revised comprehensive patch (with new WBS changes)
all.3.tgz (3.8 KB) - added by farialima 2 years ago.

Download all attachments as: .zip

Change History (27)

Changed 4 years ago by Chris.Nelson@…

Fix a typo in a comment

Changed 4 years ago by Chris.Nelson@…

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

Changed 4 years ago by Chris.Nelson@…

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

Changed 4 years ago by Chris.Nelson@…

Handle relative ticket fields

Changed 4 years ago by Chris.Nelson@…

Handle WBS numbers

Changed 4 years ago by Chris.Nelson@…

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

comment:1 Changed 4 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 4 years ago by Chris.Nelson@…

Improved WBS patch

Changed 4 years ago by Chris.Nelson@…

Revised comprehensive patch (with new WBS changes)

comment:2 follow-ups: Changed 4 years ago by farialima

  • Owner changed from farialima 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 4 years ago by AdrianFritz

  • Summary changed from Handle references between imported tickets to [PATCH] Handle references between imported tickets

comment:4 in reply to: ↑ 2 Changed 4 years ago by ChrisNelson

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 4 years ago by ChrisNelson

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 4 years ago by farialima

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 3 years ago by rjollos

  • Owner changed from Chris.Nelson@… to ChrisNelson
  • Reporter changed from Chris.Nelson@… to ChrisNelson

comment:8 Changed 2 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 2 years ago by farialima

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 2 years ago by farialima

comment:10 Changed 2 years ago by farialima

  • Resolution set to fixed
  • Status changed from new to closed

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 2 years ago by falkb

Thanks a lot, gonna test it on Monday

comment:12 Changed 2 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 follow-up: Changed 2 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 ; follow-up: Changed 2 years ago by farialima

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 ; follow-up: Changed 2 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 2 years ago by ChrisNelson

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 2 years ago by farialima

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 2 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...

Add Comment

Modify Ticket

Action
as closed .
The resolution will be deleted. Next status will be 'reopened'.
Author


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

 
Note: See TracTickets for help on using tickets.