← Back to team overview

apport-hackers team mailing list archive

[Merge] lp:~brian-murray/apport/copy-dupes-tags into lp:apport

 

Brian Murray has proposed merging lp:~brian-murray/apport/copy-dupes-tags into lp:apport.

Requested reviews:
  Apport upstream developers (apport-hackers)

For more details, see:
https://code.launchpad.net/~brian-murray/apport/copy-dupes-tags/+merge/106049

Its possible the retracer marks a quantal (or any release) as a duplicate of a older crash report tagged about a previous release, so if we search for just quantal crashes we won't see this older master bug receiving duplicates from quantal.  To remedy this I think the release tags should be copied over from duplicate bug reports to the master bug report (if they don't already exist there).  Actually, all tags should be copied over as they are likely to already exist and those that don't would be useful.  Consider the case where the master report is on an i386 system and the duplicate is on amd64.  It'd might be useful to have the amd64 tag on the master (it certainly wouldn't hurt).

Also when looking at the code I noticed master.tags is queried multiple times which likely slows down the process so I cached it.
-- 
https://code.launchpad.net/~brian-murray/apport/copy-dupes-tags/+merge/106049
Your team Apport upstream developers is requested to review the proposed merge of lp:~brian-murray/apport/copy-dupes-tags into lp:apport.
=== modified file 'apport/crashdb_impl/launchpad.py'
--- apport/crashdb_impl/launchpad.py	2012-05-16 10:09:31 +0000
+++ apport/crashdb_impl/launchpad.py	2012-05-16 20:11:18 +0000
@@ -691,21 +691,25 @@
             if not bug.duplicate_of:
                 bug.duplicate_of = master
 
+            # cache tags of master bug report instead of performing multiple
+            # queries
+            master_tags = master.tags
+
             if len(master.duplicates) == 10:
                 if 'escalation_tag' in self.options and \
-                    self.options['escalation_tag'] not in master.tags and \
-                    self.options.get('escalated_tag', ' invalid ') not in master.tags:
-                        master.tags = master.tags + [self.options['escalation_tag']]  # LP#254901 workaround
+                    self.options['escalation_tag'] not in master_tags and \
+                    self.options.get('escalated_tag', ' invalid ') not in master_tags:
+                        master.tags = master_tags + [self.options['escalation_tag']]  # LP#254901 workaround
                         master.lp_save()
 
                 if 'escalation_subscription' in self.options and \
-                    self.options.get('escalated_tag', ' invalid ') not in master.tags:
+                    self.options.get('escalated_tag', ' invalid ') not in master_tags:
                     p = self.launchpad.people[self.options['escalation_subscription']]
                     master.subscribe(person=p)
 
             # requesting updated stack trace?
-            if report.has_useful_stacktrace() and ('apport-request-retrace' in master.tags
-                    or 'apport-failed-retrace' in master.tags):
+            if report.has_useful_stacktrace() and ('apport-request-retrace' in master_tags
+                    or 'apport-failed-retrace' in master_tags):
                 self.update(master_id, report, 'Updated stack trace from duplicate bug %i' % id,
                         key_filter=['Stacktrace', 'ThreadStacktrace',
                             'Package', 'Dependencies', 'ProcMaps', 'ProcCmdline'])
@@ -726,6 +730,15 @@
                 except HTTPError:
                     pass  # LP#336866 workaround
 
+            # copy tags over from the duplicate bug to the master bug
+            dupe_tags = set(bug.tags)
+            # reload master tags as they have changed
+            master_tags = master.tags
+            missing_tags = dupe_tags.difference(master_tags)
+
+            master.tags = master_tags + list(missing_tags)
+            master.lp_save()
+
         else:
             if bug.duplicate_of:
                 bug.duplicate_of = None


Follow ups