Merge lp://staging/~j/trac-launchpad-migrator/component-import into lp://staging/trac-launchpad-migrator

Proposed by j^
Status: Merged
Approved by: Graham Binns
Approved revision: not available
Merged at revision: not available
Proposed branch: lp://staging/~j/trac-launchpad-migrator/component-import
Merge into: lp://staging/trac-launchpad-migrator
Diff against target: 51 lines (+16/-1)
2 files modified
README (+4/-0)
migrate.py (+12/-1)
To merge this branch: bzr merge lp://staging/~j/trac-launchpad-migrator/component-import
Reviewer Review Type Date Requested Status
Graham Binns (community) Approve
Review via email: mp+17438@code.staging.launchpad.net
To post a comment you must log in.
Revision history for this message
j^ (j) wrote :

this adds an option to only import tickets for one component instead of all tickets.

21. By j^

add note about component migration to README

Revision history for this message
Graham Binns (gmb) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'README'
2--- README 2009-06-17 14:46:38 +0000
3+++ README 2010-01-15 02:53:09 +0000
4@@ -27,6 +27,10 @@
5 <output-filename> containing the Trac tickets formatted using the
6 Launchpad bug interchange format.
7
8+To only migrate tickets for one component use this command:
9+
10+./migrate.py <path/to/trac/db> <path/to/attachments/dir> <output-filename> \
11+ --component component_name
12
13 Known issues
14 ------------
15
16=== modified file 'migrate.py'
17--- migrate.py 2009-10-20 10:31:04 +0000
18+++ migrate.py 2010-01-15 02:53:09 +0000
19@@ -368,6 +368,7 @@
20
21 trac_reporter = db.get_user(reporter)
22 #reporter_email = trac_reporter.get('email', 'foo@bar.com')
23+
24 reporter_email = extract_person_email(trac_reporter)
25 if not reporter_email:
26 print '[ticket %s] pb with reporter %s' % (bug_id, reporter)
27@@ -501,6 +502,13 @@
28 filename = args[2]
29
30 try:
31+ if args[3] == '--component':
32+ component=args[4]
33+ args.pop()
34+ args.pop()
35+ except IndexError:
36+ component=None
37+ try:
38 count = args[3]
39 except IndexError:
40 count = None
41@@ -509,7 +517,10 @@
42
43 db = TracDb(trac_db, attachments_dir)
44 for ticket in db.get_tickets(count):
45- bug = create_bug(db, ticket)
46+ if not component or ticket['component'] == component:
47+ bug = create_bug(db, ticket)
48+ else:
49+ bug = None
50 if not bug:
51 continue
52

Subscribers

People subscribed via source and target branches

to all changes: