~cyphermox/apport/bugpatterns

« back to all changes in this revision

Viewing changes to search-bugs

  • Committer: Brian Murray
  • Date: 2016-09-14 22:11:39 UTC
  • Revision ID: brian@canonical.com-20160914221139-ly10t8rxbc8zdgg0
cache the task's bug number instead of looking it up all the time

Show diffs side-by-side

added added

removed removed

Lines of Context:
161
161
    # they should be retraced first
162
162
    if 'need-i386-retrace' in task.bug.tags or 'need-amd64-retrace' in task.bug.tags:
163
163
        continue
 
164
    task_number = task.bug.id
164
165
    try:
165
 
        report = db.download(task.bug.id)
 
166
        report = db.download(task_number)
166
167
    except AssertionError as error:
167
 
        print("LP: #%s: %s" % (task.bug.id, error))
 
168
        print("LP: #%s: %s" % (task_number, error))
168
169
        continue
169
170
    except Exception as error:
170
 
        print("LP: #%s: %s" % (task.bug.id, error))
 
171
        print("LP: #%s: %s" % (task_number, error))
171
172
        continue
172
173
    except AttributeError as error:
173
 
        print("LP: #%s: %s" % (task.bug.id, error))
 
174
        print("LP: #%s: %s" % (task_number, error))
174
175
        continue
175
176
 
176
177
    # trim the dpkg log file
186
187
        # this should handle wiki urls somehow
187
188
        master_number = match.split('/')[-1]
188
189
        master = lp.bugs[master_number]
189
 
        if str(master_number) == str(task.bug.id) and not opt.all:
 
190
        if str(master_number) == str(task_number) and not opt.all:
190
191
            print "Reached master bug LP: #%s" % master_number
191
192
            break
192
 
        print('LP: #%s (%s, %s): Matched bug pattern: %s with %s dupes' % (task.bug.id,
 
193
        if int(task_number) == int(master_number):
 
194
            continue
 
195
        print('LP: #%s (%s, %s): Matched bug pattern: %s with %s dupes' % (task_number,
193
196
            task.status, task.importance, match, master.number_of_duplicates))
194
197
        if opt.consolidate:
195
198
            bug = task.bug
196
199
            if 'bot-stop-nagging' in bug.tags:
197
 
                print('LP: #%s is tagged bot-stop-nagging' % (bug.id))
 
200
                print('LP: #%s is tagged bot-stop-nagging' % (task_number))
198
201
                break
199
202
            if bug.duplicate_of:
200
 
                print('LP: #%s is already a duplicate of another bug' % (bug.id))
 
203
                print('LP: #%s is already a duplicate of another bug' % (task_number))
201
204
                break
202
205
            elif int(bug.id) == int(master_number):
203
206
                continue
204
207
            mark_as_duplicate(master_number, bug)
205
208
    elif match and opt.quiet:
206
 
        print('%s' % (task.bug.id))
 
209
        print('%s' % (task_number))