--- a/migrate-3rdparty/allura_import.py
+++ b/migrate-3rdparty/allura_import.py
@@ -4,6 +4,7 @@
import urlparse
import hmac
import hashlib
+import json
from optparse import OptionParser
from pprint import pprint
from datetime import datetime
@@ -19,6 +20,7 @@
optparser.add_option('-t', '--tracker', dest='tracker', help='Tracker to import to')
optparser.add_option('-u', '--base-url', dest='base_url', default='https://sourceforge.net', help='Base Allura URL (%default)')
optparser.add_option('-o', dest='import_opts', default=[], action='append', help='Specify import option(s)', metavar='opt=val')
+ optparser.add_option('-m', dest='user_map', default=[], action='append', help='Map users', metavar='import_user=allura_user')
optparser.add_option('--validate', dest='validate', action='store_true', help='Validate import data')
optparser.add_option('-v', '--verbose', dest='verbose', action='store_true', help='Verbose operation')
options, args = optparser.parse_args()
@@ -73,7 +75,12 @@
k, v = s.split('=', 1)
if v == 'false':
v = False
- import_options['option_' + k] = v
+ import_options[k] = v
+ import_options['user_map'] = {}
+ for s in options.user_map:
+ k, v = s.split('=', 1)
+ import_options['user_map'][k] = v
+
cli = AlluraRestClient(options.base_url, options.api_key, options.secret_key)
- print cli.call(url, doc=open(args[0]).read(), **import_options)
+ print cli.call(url, doc=open(args[0]).read(), options=json.dumps(import_options))