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
=== 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 @@
414 date_fix_released = None414 date_fix_released = None
415 if bugtask.date_fix_released:415 if bugtask.date_fix_released:
416 date_fix_released = bugtask.date_fix_released.ctime()416 date_fix_released = bugtask.date_fix_released.ctime()
417 if " (Ubuntu)" in source_pkg:
418 source_pkg = source_pkg.split(" ")[0]
417419
418 tag_list = bugtask.bug.tags420 tag_list = bugtask.bug.tags
419 bugtask_dict = {421 bugtask_dict = {
420422
=== 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 @@
34except:34except:
35 # If launchpad threw an exception, it's probably just LP being down.35 # If launchpad threw an exception, it's probably just LP being down.
36 # We'll catch up next time we run36 # We'll catch up next time we run
37 sys.stderr.write("Error: Unknown launchpad failure")37 sys.stderr.write("Error: Unknown launchpad failure\n")
38 sys.exit(1)38 sys.exit(1)
3939
4040
4141
=== 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 @@
1#!/usr/bin/python
2#
3# merge json files if they have the same keys else explode
4
5import simplejson as json
6import sys
7
8data_files = sys.argv[1:]
9
10keys = []
11bug_tasks = []
12
13for data_file in data_files:
14 json_file = open(data_file, 'r')
15 json_data = json.load(json_file)
16 if not keys:
17 keys = json_data['keys']
18 if keys == json_data['keys']:
19 for bugtask in json_data['bug_tasks']:
20 bug_tasks.append(bugtask)
21 else:
22 sys.stderr.write("json files don't have the same keys\n")
23 sys.exit(1)
24 json_file.close()
25
26report = {
27 'keys' : keys,
28 'bug_tasks' : bug_tasks
29}
30
31print json.dumps(report, indent=4)

Subscribers

People subscribed via source and target branches

to status/vote changes: