This branch adds another column "number of bugs in a distribution that have patches attached and which may be intersting for the upstream project" to the "upstream report" page. See also bug 283941. While Jorge suggested in the report to add the new number in parentheses after the last number in each row, I opted to add another column so that we can display a column header. Having numbers without any explanation does IMHO not make much sense, and the page requires already a wiki page with lots of explanations. Technical changes: The last value of the current implementation of the page is the difference of the numbers in the columns "Upstream" and "Watch", giving the number of bugs in Ubuntu where the upstream project does not have a corresponding bug. These numbers come from an SQL query in Distribution.getPackagesAndPublicUpstreamBugCounts(); the SQL expressions are COUNT(DISTINCT CASE WHEN Bugtask.status IN %(unresolved)s THEN RelatedBugTask.bug END) AS bugs_affecting_upstream, for "Upstream" and COUNT(DISTINCT CASE WHEN Bugtask.status in %(unresolved)s AND (RelatedBugTask.bugwatch IS NOT NULL OR RelatedProduct.official_malone IS TRUE) THEN RelatedBugTask.bug END) AS bugs_with_upstream_bugwatch, for "Watch". We can get the difference between these numbers by inverting the expression (RelatedBugTask.bugwatch IS NOT NULL OR RelatedProduct.official_malone IS TRUE) which is RelatedBugTask.bugwatch IS NULL AND RelatedProduct.official_malone IS FALSE (Note that the value of the column RelatedProduct.official_malone may not be NULL). In plain words: "The number of bugs where we have a bugtask in the Launchpad project and in Ubuntu, but where the upstream project does not use Launchpad". IOW, the number of bugs that have been marked in Launchpad as affecting the upstream project, but where we don't know about a corresponding bug in the real upstream bug tracker. From these bugs, we only want those that have a patch attached, so we add another term for this condition, giving this COUNT expression for the new column of the upstream report page: COUNT(DISTINCT CASE WHEN Bugtask.status in %(unresolved)s AND RelatedBugTask.bugwatch IS NULL AND RelatedProduct.official_malone IS FALSE AND Bug.latest_patch_uploaded IS NOT NULL The remaining changes are mostly mechanical: The tuples returned by Distribution.getPackagesAndPublicUpstreamBugCounts() now have another element, so the callsite had to be changed DistributionUpstreamBugReport.initialize() had to be changed too. The values of each displayed on the +upstreamreport gae are stored in insteances of class BugReportData, so this class is now also aware of the new number. Finally, the number "bugs with patches interesting for upstream" is displayed as a link to a bug search oage. The link is the same as the one for the next column to the left, but with the additional parameter "show only bugs having patches". The remaing changes are added and changed tests and a bit of lint cleanup. = Launchpad lint = Checking for conflicts. and issues in doctests and templates. Running jslint, xmllint, pyflakes, and pylint. Using normal rules. Linting changed files: lib/lp/bugs/browser/bugtask.py lib/lp/bugs/browser/distribution_upstream_bug_report.py lib/lp/bugs/doc/distribution-upstream-bug-report.txt lib/lp/bugs/stories/distribution/xx-distribution-upstream-bug-report.txt lib/lp/bugs/templates/distribution-upstream-bug-report.pt lib/lp/registry/model/distribution.py == Pylint notices == lib/lp/bugs/browser/bugtask.py 75: [F0401] Unable to import 'lazr.delegates' (No module named delegates) 76: [F0401] Unable to import 'lazr.enum' (No module named enum) 78: [F0401] Unable to import 'lazr.lifecycle.event' (No module named lifecycle) 79: [F0401] Unable to import 'lazr.lifecycle.snapshot' (No module named lifecycle) 80: [F0401] Unable to import 'lazr.restful.interface' (No module named restful) 81: [F0401] Unable to import 'lazr.restful.interfaces' (No module named restful) 97: [F0401] Unable to import 'lazr.uri' (No module named uri) 150: [F0401] Unable to import 'lazr.restful.interfaces' (No module named restful) 2816: [C0322, NominationsReviewTableBatchNavigatorView.submit_action] Operator not preceded by a space condition=canApproveNominations) ^ def submit_action(self, action, data):