1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
|
#!/usr/bin/python2.4
# Copyright 2006 Canonical Ltd. All rights reserved.
import logging
import optparse
import sys
import _pythonpath
from zope.component import getUtility
from canonical.config import config
from canonical.lp import initZopeless
from canonical.launchpad.interfaces import IProductSet
from canonical.launchpad.scripts import (
execute_zcml_for_scripts, logger_options, logger)
from canonical.launchpad.ftests import login
from canonical.launchpad.scripts.sftracker import Tracker, TrackerImporter
def main(argv):
parser = optparse.OptionParser(description="This script imports bugs "
"from Sourceforge into Launchpad.")
parser.add_option('--product', metavar='PRODUCT', action='store',
help='The product to associate bugs with',
type='string', dest='product', default=None)
parser.add_option('--dumpfile', metavar='XML', action='store',
help='The XML tracker data dump',
type='string', dest='dumpfile', default=None)
parser.add_option('--dumpdir', metavar='DIR', action='store',
help='The directory with the dumped tracker data',
type='string', dest='dumpdir', default=None)
parser.add_option('--verify-users', dest='verify_users',
help='Should created users have verified emails?',
action='store_true', default=False)
logger_options(parser, logging.INFO)
options, args = parser.parse_args(argv[1:])
logger(options, 'canonical.launchpad.scripts.sftracker')
# don't send email
config.zopeless.send_email = False
ztm = initZopeless()
execute_zcml_for_scripts()
login('bug-importer@launchpad.net')
product = getUtility(IProductSet).getByName(options.product)
tracker = Tracker(options.dumpfile, options.dumpdir)
importer = TrackerImporter(product, options.verify_users)
importer.importTracker(ztm, tracker)
if __name__ == '__main__':
sys.exit(main(sys.argv))
|