arsenal-devel team mailing list archive
-
arsenal-devel team
-
Mailing list archive
-
Message #00120
[Merge] lp:~brian-murray/arsenal/date_last_updated into lp:arsenal
Brian Murray has proposed merging lp:~brian-murray/arsenal/date_last_updated into lp:arsenal.
Requested reviews:
arsenal-devel (arsenal-devel)
For more details, see:
https://code.launchpad.net/~brian-murray/arsenal/date_last_updated/+merge/83876
Loading the bug data for bugs that haven't changed is really unnecessary. This branch checks the date_last_updated for a bug in the json file and sees if the bug's date_last_updated is more recent than it, if it is then the bug data is retrieved.
I wanted to have another person look at it before merging it - just in case.
--
https://code.launchpad.net/~brian-murray/arsenal/date_last_updated/+merge/83876
Your team arsenal-devel is requested to review the proposed merge of lp:~brian-murray/arsenal/date_last_updated into lp:arsenal.
=== modified file 'reports/cbd'
--- reports/cbd 2011-11-21 18:01:57 +0000
+++ reports/cbd 2011-11-29 23:29:24 +0000
@@ -72,6 +72,9 @@
stdo(' contains the mappings from packages to teams and from \n')
stdo(' milestone to milestone-date. \n')
stdo(' \n')
+ stdo(' --privates Include private bugs in the results. \n')
+ stdo(' \n')
+ stdo(' --updated-only Only retrieve bug data for bugs which have been recently updated. \n')
stdo(' \n')
stdo(' Examples: \n')
stdo(' %s iso-testing-bugs.json \n' % defaults['app_name'])
@@ -88,7 +91,7 @@
try:
cfg = defaults
optsShort = ''
- optsLong = ['help', 'debug=', 'cached-lp-resources=', 'quiet']
+ optsLong = ['help', 'debug=', 'cached-lp-resources=', 'quiet', 'privates', 'updated-only']
opts, args = getopt(argv[1:], optsShort, optsLong)
for opt, val in opts:
@@ -104,6 +107,12 @@
if level not in Dbg.levels:
Dbg.levels.append(level)
+ elif opt in ('--privates'):
+ cfg['show_private_bugs'] = True
+
+ elif opt in ('--updated-only'):
+ cfg['updated_only'] = True
+
elif opt in ('--cached-lp-resources'):
cfg['cached_resources'] = val
@@ -332,6 +341,14 @@
self.initialize()
search_start = datetime.utcnow()
+ # old_tasks loaded from json file
+ if self.cfg['updated_only']:
+ last_run = json_load(self.cfg['json_file'])
+ try:
+ old_tasks = last_run['tasks']
+ except KeyError:
+ print("Old tasks not loaded as they aren't in the json file")
+ old_tasks = {}
iso_tasks = {}
# For each 'search_criteria' section of the config file:
@@ -360,9 +377,23 @@
#
if bug_number not in iso_tasks:
iso_tasks[bug_number] = []
+ if self.cfg['updated_only']:
+ if str(bug_number) in old_tasks.keys():
+ try:
+ # this could be way better
+ old_bug = old_tasks['%s' % bug_number][0]
+ except IndexError:
+ old_bug = None
+ # the date_last_updated info gets stripped a lot in date_to_string
+ last_update = task.bug.date_last_updated.replace(second=0, microsecond=0, tzinfo=None)
+ if old_bug is not None and last_update <= string_to_date(old_bug['bug']['date_last_updated']):
+ if not self.cfg['run_quietly']:
+ stdo("LP: #%s is being skipped as it hasn't been updated" % bug_number)
+ iso_tasks[bug_number] = old_tasks['%s' % bug_number]
+ continue
try:
- if not task.bug.private:
+ if not task.bug.private or self.cfg['show_private_bugs']:
t = self.get_task_info(task)
t['debug']['series'] = s
t_name = t['bug_target_name']
@@ -546,6 +577,8 @@
defaults = {}
defaults['app_name'] = argv[0]
defaults['run_quietly'] = False
+ defaults['show_private_bugs'] = False
+ defaults['updated_only'] = False
# The cmdline processing is done here partially so the debug options
# can be processed right away.
Follow ups