← Back to team overview

arsenal-devel team mailing list archive

[Merge] lp:~brian-murray/arsenal/improvements into lp:arsenal

 

Brian Murray has proposed merging lp:~brian-murray/arsenal/improvements into lp:arsenal.

Requested reviews:
  arsenal-devel (arsenal-devel)


added in a tool for merging multiple json files useful if you want to merge a search for all bugs with a tag in a ubuntu and all different kind of bugs with a milestone in ubuntu
-- 
https://code.launchpad.net/~brian-murray/arsenal/improvements/+merge/21272
Your team arsenal-devel is subscribed to branch lp:arsenal.
=== modified file 'scripts/arsenal_lib.py'
--- scripts/arsenal_lib.py	2010-03-05 20:21:05 +0000
+++ scripts/arsenal_lib.py	2010-03-12 18:45:32 +0000
@@ -414,6 +414,8 @@
     date_fix_released = None
     if bugtask.date_fix_released:
         date_fix_released = bugtask.date_fix_released.ctime()
+    if " (Ubuntu)" in source_pkg:
+        source_pkg = source_pkg.split(" ")[0]
 
     tag_list = bugtask.bug.tags
     bugtask_dict = {

=== modified file 'scripts/ls-tag-json.py'
--- scripts/ls-tag-json.py	2010-03-10 01:15:11 +0000
+++ scripts/ls-tag-json.py	2010-03-12 18:45:32 +0000
@@ -34,7 +34,7 @@
 except:
     # If launchpad threw an exception, it's probably just LP being down.
     # We'll catch up next time we run
-    sys.stderr.write("Error:  Unknown launchpad failure")
+    sys.stderr.write("Error:  Unknown launchpad failure\n")
     sys.exit(1)
 
 

=== added file 'scripts/merge-json.py'
--- scripts/merge-json.py	1970-01-01 00:00:00 +0000
+++ scripts/merge-json.py	2010-03-12 18:45:32 +0000
@@ -0,0 +1,31 @@
+#!/usr/bin/python
+#
+# merge json files if they have the same keys else explode
+
+import simplejson as json
+import sys
+
+data_files = sys.argv[1:]
+
+keys = []
+bug_tasks = []
+
+for data_file in data_files:
+    json_file = open(data_file, 'r')
+    json_data = json.load(json_file)
+    if not keys:
+        keys = json_data['keys']
+    if keys == json_data['keys']:
+        for bugtask in json_data['bug_tasks']:
+            bug_tasks.append(bugtask)
+    else:
+        sys.stderr.write("json files don't have the same keys\n")
+        sys.exit(1)
+    json_file.close()
+
+report = {
+    'keys'      : keys,
+    'bug_tasks' : bug_tasks
+}
+
+print json.dumps(report, indent=4)


Follow ups