You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@allura.apache.org by jo...@apache.org on 2013/03/28 21:45:23 UTC

[1/3] git commit: Create a new JSON object for the ticket to import

Updated Branches:
  refs/heads/master cbbd95eea -> e8161e69c


Create a new JSON object for the ticket to import

If the imported JSON object doesn't have the correct structure we need
to create it.


Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/e8161e69
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/e8161e69
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/e8161e69

Branch: refs/heads/master
Commit: e8161e69c103daed29313d626cb358c3423e46ed
Parents: 5a3ff20
Author: Jon Schewe <jp...@mtu.net>
Authored: Tue Mar 26 18:32:18 2013 -0500
Committer: Cory Johns <cj...@slashdotmedia.com>
Committed: Thu Mar 28 20:42:12 2013 +0000

----------------------------------------------------------------------
 scripts/allura_import.py |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/e8161e69/scripts/allura_import.py
----------------------------------------------------------------------
diff --git a/scripts/allura_import.py b/scripts/allura_import.py
index e6982b2..60858ea 100644
--- a/scripts/allura_import.py
+++ b/scripts/allura_import.py
@@ -81,8 +81,11 @@ def import_tracker(cli, project, tool, import_options, options, doc_txt, validat
                 if options.verbose:
                     print 'Ticket id %d already exists, skipping' % ticket_in['id']
                 continue
-            doc['trackers']['default']['artifacts'] = [ticket_in]
-            res = cli.call(url, doc=json.dumps(doc), options=json.dumps(import_options))
+            doc_import={}
+            doc_import['trackers'] = {}
+            doc_import['trackers']['default'] = {}
+            doc_import['trackers']['default']['artifacts'] = [ticket_in]
+            res = cli.call(url, doc=json.dumps(doc_import), options=json.dumps(import_options))
             assert res['status'] and not res['errors']
             if options.validate:
                 if res['warnings']:


[3/3] git commit: Output the URL being used to import tickets when verbose is turned on

Posted by jo...@apache.org.
Output the URL being used to import tickets when verbose is turned on


Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/5c079303
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/5c079303
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/5c079303

Branch: refs/heads/master
Commit: 5c079303c38f33edb1f603ea6f4f02ccc2f01506
Parents: cbbd95e
Author: Jon Schewe <jp...@mtu.net>
Authored: Tue Mar 26 18:26:43 2013 -0500
Committer: Cory Johns <cj...@slashdotmedia.com>
Committed: Thu Mar 28 20:42:12 2013 +0000

----------------------------------------------------------------------
 Allura/allura/lib/import_api.py |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/5c079303/Allura/allura/lib/import_api.py
----------------------------------------------------------------------
diff --git a/Allura/allura/lib/import_api.py b/Allura/allura/lib/import_api.py
index 365532d..ea07756 100644
--- a/Allura/allura/lib/import_api.py
+++ b/Allura/allura/lib/import_api.py
@@ -30,6 +30,9 @@ class AlluraImportApiClient(object):
 
     def call(self, url, **params):
         url = urlparse.urljoin(self.base_url, url)
+        if self.verbose:
+            print "Using URL '%s'" % (url)
+        
         params = self.sign(urlparse.urlparse(url).path, params.items())
 
         while True:


[2/3] git commit: Check if the document to import has trackers or is just a list of tickets

Posted by jo...@apache.org.
Check if the document to import has trackers or is just a list of
tickets

When exporting with trac_export.py the tickets are the top level list of
objects in the JSON dump.


Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/5a3ff203
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/5a3ff203
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/5a3ff203

Branch: refs/heads/master
Commit: 5a3ff203beeab56516d812886a74a3a8a61893d4
Parents: 5c07930
Author: Jon Schewe <jp...@mtu.net>
Authored: Tue Mar 26 18:30:15 2013 -0500
Committer: Cory Johns <cj...@slashdotmedia.com>
Committed: Thu Mar 28 20:42:12 2013 +0000

----------------------------------------------------------------------
 scripts/allura_import.py |    9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/5a3ff203/scripts/allura_import.py
----------------------------------------------------------------------
diff --git a/scripts/allura_import.py b/scripts/allura_import.py
index 1dd151c..e6982b2 100644
--- a/scripts/allura_import.py
+++ b/scripts/allura_import.py
@@ -66,8 +66,13 @@ def import_tracker(cli, project, tool, import_options, options, doc_txt, validat
             existing_map[t['ticket_num']] = t['summary']
 
     doc = json.loads(doc_txt)
-    tickets_in = doc['trackers']['default']['artifacts']
-    doc['trackers']['default']['artifacts'] = []
+
+    if 'trackers' in doc and 'default' in doc['trackers'] and 'artifacts' in doc['trackers']['default']:
+        tickets_in = doc['trackers']['default']['artifacts']
+        doc['trackers']['default']['artifacts'] = []
+    else:
+        tickets_in = doc
+        
     if options.verbose:
         print "Processing %d tickets" % len(tickets_in)