Merge lp:~brian-murray/arsenal/improvements into lp:arsenal/trunk

Proposed by Brian Murray
Status: Merged
Merge reported by: Bryce Harrington
Merged at revision: not available
Proposed branch: lp:~brian-murray/arsenal/improvements
Merge into: lp:arsenal/trunk
Diff against target: 61 lines (+34/-1)
3 files modified
scripts/arsenal_lib.py (+2/-0)
scripts/ls-tag-json.py (+1/-1)
scripts/merge-json.py (+31/-0)
To merge this branch: bzr merge lp:~brian-murray/arsenal/improvements
Reviewer Review Type Date Requested Status
Bryce Harrington Pending
Review via email: mp+21272@code.launchpad.net

Description of the change

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

To post a comment you must log in.
Revision history for this message
Bryce Harrington (bryce) wrote :

Looks good

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'scripts/arsenal_lib.py'
2--- scripts/arsenal_lib.py 2010-03-05 20:21:05 +0000
3+++ scripts/arsenal_lib.py 2010-03-12 18:45:32 +0000
4@@ -414,6 +414,8 @@
5 date_fix_released = None
6 if bugtask.date_fix_released:
7 date_fix_released = bugtask.date_fix_released.ctime()
8+ if " (Ubuntu)" in source_pkg:
9+ source_pkg = source_pkg.split(" ")[0]
10
11 tag_list = bugtask.bug.tags
12 bugtask_dict = {
13
14=== modified file 'scripts/ls-tag-json.py'
15--- scripts/ls-tag-json.py 2010-03-10 01:15:11 +0000
16+++ scripts/ls-tag-json.py 2010-03-12 18:45:32 +0000
17@@ -34,7 +34,7 @@
18 except:
19 # If launchpad threw an exception, it's probably just LP being down.
20 # We'll catch up next time we run
21- sys.stderr.write("Error: Unknown launchpad failure")
22+ sys.stderr.write("Error: Unknown launchpad failure\n")
23 sys.exit(1)
24
25
26
27=== added file 'scripts/merge-json.py'
28--- scripts/merge-json.py 1970-01-01 00:00:00 +0000
29+++ scripts/merge-json.py 2010-03-12 18:45:32 +0000
30@@ -0,0 +1,31 @@
31+#!/usr/bin/python
32+#
33+# merge json files if they have the same keys else explode
34+
35+import simplejson as json
36+import sys
37+
38+data_files = sys.argv[1:]
39+
40+keys = []
41+bug_tasks = []
42+
43+for data_file in data_files:
44+ json_file = open(data_file, 'r')
45+ json_data = json.load(json_file)
46+ if not keys:
47+ keys = json_data['keys']
48+ if keys == json_data['keys']:
49+ for bugtask in json_data['bug_tasks']:
50+ bug_tasks.append(bugtask)
51+ else:
52+ sys.stderr.write("json files don't have the same keys\n")
53+ sys.exit(1)
54+ json_file.close()
55+
56+report = {
57+ 'keys' : keys,
58+ 'bug_tasks' : bug_tasks
59+}
60+
61+print json.dumps(report, indent=4)

Subscribers

People subscribed via source and target branches

to status/vote changes: