Merge lp:~adeuring/launchpad/bug-283941-show-patch-numbers-on-upstream-report into lp:launchpad/db-devel

Proposed by Abel Deuring
Status: Merged
Merged at revision: not available
Proposed branch: lp:~adeuring/launchpad/bug-283941-show-patch-numbers-on-upstream-report
Merge into: lp:launchpad/db-devel
Diff against target: 486 lines (+153/-51)
6 files modified
lib/lp/bugs/browser/bugtask.py (+4/-1)
lib/lp/bugs/browser/distribution_upstream_bug_report.py (+17/-5)
lib/lp/bugs/doc/distribution-upstream-bug-report.txt (+66/-25)
lib/lp/bugs/stories/distribution/xx-distribution-upstream-bug-report.txt (+32/-16)
lib/lp/bugs/templates/distribution-upstream-bug-report.pt (+21/-1)
lib/lp/registry/model/distribution.py (+13/-3)
To merge this branch: bzr merge lp:~adeuring/launchpad/bug-283941-show-patch-numbers-on-upstream-report
Reviewer Review Type Date Requested Status
Curtis Hovey (community) ui Approve
Brad Crittenden (community) code Approve
Review via email: mp+19405@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Abel Deuring (adeuring) wrote :
Download full text (4.5 KiB)

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 ...

Read more...

Revision history for this message
Brad Crittenden (bac) wrote :
Download full text (19.3 KiB)

Hi Abel,

Thanks for this branch. It looks good to me except for a couple of
questions. Please do have a UI review too.

--Brad

> === modified file 'lib/lp/bugs/browser/bugtask.py'
--- lib/lp/bugs/browser/bugtask.py 2010-02-03 21:11:53 +0000
> +++ lib/lp/bugs/browser/bugtask.py 2010-02-16 16:16:26 +0000
> @@ -1858,7 +1858,8 @@
>
>
> def get_buglisting_search_filter_url(
> - assignee=None, importance=None, status=None, status_upstream=None):
> + assignee=None, importance=None, status=None, status_upstream=None,
> + has_patches=None):
> """Return the given URL with the search parameters specified."""
> search_params = []
>
> @@ -1870,6 +1871,8 @@
> search_params.append(('field.status', status))
> if status_upstream is not None:
> search_params.append(('field.status_upstream', status_upstream))
> + if has_patches is not None:
> + search_params.append(('field.has_patch', 'on'))
>
> query_string = urllib.urlencode(search_params, doseq=True)
>

> === modified file 'lib/lp/bugs/browser/distribution_upstream_bug_report.py'
> --- lib/lp/bugs/browser/distribution_upstream_bug_report.py 2009-06-25 00:40:31 +0000
> +++ lib/lp/bugs/browser/distribution_upstream_bug_report.py 2010-02-16 16:16:26 +0000
> @@ -60,11 +60,12 @@
> BAD_THRESHOLD = 20
>
> def __init__(self, open_bugs=0, triaged_bugs=0, upstream_bugs=0,
> - watched_bugs=0):
> + watched_bugs=0, bugs_with_upstream_patches=0):
> self.open_bugs = open_bugs
> self.triaged_bugs = triaged_bugs
> self.upstream_bugs = upstream_bugs
> self.watched_bugs = watched_bugs
> + self.bugs_with_upstream_patches = bugs_with_upstream_patches
>
> @property
> def triaged_bugs_percentage(self):
> @@ -148,9 +149,9 @@
> - *_url: convenience URLs
> """
> def __init__(self, dsp, dssp, product, open_bugs, triaged_bugs,
> - upstream_bugs, watched_bugs):
> + upstream_bugs, watched_bugs, bugs_with_upstream_patches):
> BugReportData.__init__(self, open_bugs, triaged_bugs, upstream_bugs,
> - watched_bugs)
> + watched_bugs, bugs_with_upstream_patches)
> self.dsp = dsp
> self.dssp = dssp
> self.product = product
> @@ -235,6 +236,14 @@
> self.watched_bugs_delta_url = urlappend(
> dsp_bugs_url, unwatched_bugs_search_filter_url)
>
> + # The bugs with upstream patches URL links to all open upstream
> + # bugs that don't have a bugwatch but have patches attached.
> + bugs_with_upstream_patches_filter_url = (
> + get_buglisting_search_filter_url(
> + status_upstream='pending_bugwatch', has_patches=True))
> + self.bugs_with_upstream_patches_url = urlappend(
> + dsp_bugs_url, bugs_with_upstream_patches_filter_url)
> +
>
> class DistributionUpstreamBugReport(LaunchpadView):
> """Implements the actual upstream bug report.
> @@ -248,6 +257,7 @@
> valid_sort_keys = [
> 'bugtracker_name',
> 'bug_superviso...

review: Approve (code)
Revision history for this message
Abel Deuring (adeuring) wrote :
Download full text (4.3 KiB)

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi Brad,

thanks for your review!

On 16.02.2010 17:34, Brad Crittenden wrote:
> Review: Approve code
> Hi Abel,
>
> Thanks for this branch. It looks good to me except for a couple of
> questions. Please do have a UI review too.

Sure, I wont forget the UI review ;)

>
> --Brad
>
>

[...]
>> === modified file 'lib/lp/bugs/doc/distribution-upstream-bug-report.txt'
>> --- lib/lp/bugs/doc/distribution-upstream-bug-report.txt 2009-10-16 20:33:56 +0000
>> +++ lib/lp/bugs/doc/distribution-upstream-bug-report.txt 2010-02-16 16:16:26 +0000
>> @@ -131,20 +131,56 @@
>> >>> task = getUtility(IBugTaskSet).createTask(bug, name12, product=pmount)
>> >>> Store.of(task).flush()
>> >>> print_report(ubuntu.getPackagesAndPublicUpstreamBugCounts(limit=3))
>> - pmount pmount 2 2 1 0
>> - linux-source-2.6.15 None 1 0 0 0
>> - mozilla-firefox firefox 1 1 1 1
>> -
>> -Linking that task to a bugwatch makes the watch counts update:
>> + pmount pmount 2 2 1 0 0
>> + linux-source-2.6.15 None 1 0 0 0 0
>> + mozilla-firefox firefox 1 1 1 1 0
>> +
>> +The last column counts those bugs with upstream tasks that have patches
>> +attached but which don't have an upstream bugwatch. If we add a ordinary
>> +attachment to our pmount bug, the value of the last column does not
>> +change...
>> +
>> + >>> attachment = factory.makeBugAttachment(bug)
>> + >>> print_report(ubuntu.getPackagesAndPublicUpstreamBugCounts(limit=3))
>> + pmount pmount 2 2 1 0 0
>> + linux-source-2.6.15 None 1 0 0 0 0
>> + mozilla-firefox firefox 1 1 1 1 0
>> +
>> +...but when we make this attachment a patch, the value of the column
>> +increases.
>> +
>> + >>> from lp.bugs.interfaces.bugattachment import BugAttachmentType
>> + >>> attachment.type = BugAttachmentType.PATCH
>> + >>> Store.of(attachment).flush()
>> + >>> print_report(ubuntu.getPackagesAndPublicUpstreamBugCounts(limit=3))
>> + pmount pmount 2 2 1 0 1
>> + linux-source-2.6.15 None 1 0 0 0 0
>> + mozilla-firefox firefox 1 1 1 1 0
>> +
>> +Note that we count only bugs with patches for products that do not
>> +use Malone officially.
>> +
>> + >>> pmount.official_malone = True
>> + >>> Store.of(pmount).flush()
>> + >>> print_report(ubuntu.getPackagesAndPublicUpstreamBugCounts(limit=3))
>> + pmount pmount 2 2 1 1 0
>> + linux-source-2.6.15 None 1 0 0 0 0
>> + mozilla-firefox firefox 1 1 1 1 0
>
> I find having a '0' to be misleading. Would not using a '-' or some
> other indicator to show the data are not relevant be more appropriate?

Thanks, this is a nice idea -- but I prefer to implement this special
case in the template. Firstly, this keeps the code of the method
getPackagesAndPublicUpstreamBugCounts() (or the SQL query) a bit
simpler, and secondly, we calculate and display the sum over all rows
for all columns in the browser class. Having something other than a
number would make that code also more convoluted.

>> === modified file 'lib/lp/bugs/templates/distribution-upstream-bug-report.pt'
>> --- lib/l...

Read more...

Revision history for this message
Abel Deuring (adeuring) wrote :

screenshot: http://people.canonical.com/~adeuring/upstreamreport.png
The right-most column ("Patches for upstream") is new

Revision history for this message
Curtis Hovey (sinzui) wrote :

This looks good to land.

review: Approve (ui)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'lib/lp/bugs/browser/bugtask.py'
2--- lib/lp/bugs/browser/bugtask.py 2010-02-03 21:11:53 +0000
3+++ lib/lp/bugs/browser/bugtask.py 2010-02-18 09:23:13 +0000
4@@ -1858,7 +1858,8 @@
5
6
7 def get_buglisting_search_filter_url(
8- assignee=None, importance=None, status=None, status_upstream=None):
9+ assignee=None, importance=None, status=None, status_upstream=None,
10+ has_patches=None):
11 """Return the given URL with the search parameters specified."""
12 search_params = []
13
14@@ -1870,6 +1871,8 @@
15 search_params.append(('field.status', status))
16 if status_upstream is not None:
17 search_params.append(('field.status_upstream', status_upstream))
18+ if has_patches is not None:
19+ search_params.append(('field.has_patch', 'on'))
20
21 query_string = urllib.urlencode(search_params, doseq=True)
22
23
24=== modified file 'lib/lp/bugs/browser/distribution_upstream_bug_report.py'
25--- lib/lp/bugs/browser/distribution_upstream_bug_report.py 2009-06-25 00:40:31 +0000
26+++ lib/lp/bugs/browser/distribution_upstream_bug_report.py 2010-02-18 09:23:13 +0000
27@@ -60,11 +60,12 @@
28 BAD_THRESHOLD = 20
29
30 def __init__(self, open_bugs=0, triaged_bugs=0, upstream_bugs=0,
31- watched_bugs=0):
32+ watched_bugs=0, bugs_with_upstream_patches=0):
33 self.open_bugs = open_bugs
34 self.triaged_bugs = triaged_bugs
35 self.upstream_bugs = upstream_bugs
36 self.watched_bugs = watched_bugs
37+ self.bugs_with_upstream_patches = bugs_with_upstream_patches
38
39 @property
40 def triaged_bugs_percentage(self):
41@@ -148,9 +149,9 @@
42 - *_url: convenience URLs
43 """
44 def __init__(self, dsp, dssp, product, open_bugs, triaged_bugs,
45- upstream_bugs, watched_bugs):
46+ upstream_bugs, watched_bugs, bugs_with_upstream_patches):
47 BugReportData.__init__(self, open_bugs, triaged_bugs, upstream_bugs,
48- watched_bugs)
49+ watched_bugs, bugs_with_upstream_patches)
50 self.dsp = dsp
51 self.dssp = dssp
52 self.product = product
53@@ -235,6 +236,14 @@
54 self.watched_bugs_delta_url = urlappend(
55 dsp_bugs_url, unwatched_bugs_search_filter_url)
56
57+ # The bugs with upstream patches URL links to all open upstream
58+ # bugs that don't have a bugwatch but have patches attached.
59+ bugs_with_upstream_patches_filter_url = (
60+ get_buglisting_search_filter_url(
61+ status_upstream='pending_bugwatch', has_patches=True))
62+ self.bugs_with_upstream_patches_url = urlappend(
63+ dsp_bugs_url, bugs_with_upstream_patches_filter_url)
64+
65
66 class DistributionUpstreamBugReport(LaunchpadView):
67 """Implements the actual upstream bug report.
68@@ -248,6 +257,7 @@
69 valid_sort_keys = [
70 'bugtracker_name',
71 'bug_supervisor_name',
72+ 'bugs_with_upstream_patches',
73 'dsp',
74 'open_bugs',
75 'product',
76@@ -344,7 +354,8 @@
77 packages_to_exclude = self.context.upstream_report_excluded_packages
78 counts = self.context.getPackagesAndPublicUpstreamBugCounts(
79 limit=self.LIMIT, exclude_packages=packages_to_exclude)
80- for (dsp, product, open, triaged, upstream, watched) in counts:
81+ for (dsp, product, open, triaged, upstream, watched,
82+ bugs_with_upstream_patches) in counts:
83 # The +edit-packaging page is only available for
84 # IDistributionSeriesSourcepackages, so deduce one here. If
85 # the distribution doesn't have series we can't offer a link
86@@ -360,6 +371,7 @@
87 self.total.watched_bugs += watched
88
89 item = PackageBugReportData(
90- dsp, dssp, product, open, triaged, upstream, watched)
91+ dsp, dssp, product, open, triaged, upstream, watched,
92+ bugs_with_upstream_patches)
93 self._data.append(item)
94
95
96=== modified file 'lib/lp/bugs/doc/distribution-upstream-bug-report.txt'
97--- lib/lp/bugs/doc/distribution-upstream-bug-report.txt 2009-10-16 20:33:56 +0000
98+++ lib/lp/bugs/doc/distribution-upstream-bug-report.txt 2010-02-18 09:23:13 +0000
99@@ -34,20 +34,20 @@
100 them.
101
102 >>> def print_report(data):
103- ... for dsp, product, open, triaged, upstream, watch in data:
104+ ... for dsp, product, open, triaged, upstream, watch, patch in data:
105 ... print dsp.name, product and product.name or None
106- ... print open, triaged, upstream, watch
107+ ... print open, triaged, upstream, watch, patch
108
109 A first set of reports, entirely based on sampledata. There are no
110 triaged bugs, but there are some upstream ones with watches:
111
112 >>> print_report(ubuntu.getPackagesAndPublicUpstreamBugCounts())
113- linux-source-2.6.15 None 1 0 0 0
114- mozilla-firefox firefox 1 0 1 1
115- thunderbird None 1 0 1 1
116+ linux-source-2.6.15 None 1 0 0 0 0
117+ mozilla-firefox firefox 1 0 1 1 0
118+ thunderbird None 1 0 1 1 0
119
120 >>> print_report(debian.getPackagesAndPublicUpstreamBugCounts())
121- mozilla-firefox None 3 0 2 1
122+ mozilla-firefox None 3 0 2 1 0
123
124 >>> print_report(kubuntu.getPackagesAndPublicUpstreamBugCounts())
125
126@@ -58,8 +58,8 @@
127
128 >>> print_report(ubuntu.getPackagesAndPublicUpstreamBugCounts(
129 ... exclude_packages=['linux-source-2.6.15']))
130- mozilla-firefox firefox 1 0 1 1
131- thunderbird None 1 0 1 1
132+ mozilla-firefox firefox 1 0 1 1 0
133+ thunderbird None 1 0 1 1 0
134
135 To get the list of excluded packages for a distribution we can look at
136 its `upstream_report_excluded_packages` property. For Kubuntu and
137@@ -88,9 +88,9 @@
138 >>> mf_bug.transitionToStatus(BugTaskStatus.TRIAGED, mark)
139 >>> sync(mf_bug)
140 >>> print_report(ubuntu.getPackagesAndPublicUpstreamBugCounts())
141- linux-source-2.6.15 None 1 0 0 0
142- mozilla-firefox firefox 1 1 1 1
143- thunderbird None 1 1 1 1
144+ linux-source-2.6.15 None 1 0 0 0 0
145+ mozilla-firefox firefox 1 1 1 1 0
146+ thunderbird None 1 1 1 1 0
147
148 We add two new bugs to pmount in Ubuntu. From now on we'll limit the
149 results to 3 packages (as a demonstration of the API) so thunderbird
150@@ -106,9 +106,9 @@
151 ... status=BugTaskStatus.TRIAGED)
152 >>> ubuntu_pmount_task = bug.bugtasks[0]
153 >>> print_report(ubuntu.getPackagesAndPublicUpstreamBugCounts(limit=3))
154- pmount None 2 2 0 0
155- linux-source-2.6.15 None 1 0 0 0
156- mozilla-firefox firefox 1 1 1 1
157+ pmount None 2 2 0 0 0
158+ linux-source-2.6.15 None 1 0 0 0 0
159+ mozilla-firefox firefox 1 1 1 1 0
160
161 As you can see, there is no packaging data for pmount in Ubuntu, so no
162 upstream is reported for it. Let's fix that:
163@@ -121,9 +121,9 @@
164 ... pmount.getSeries('trunk'), pmount_spn,
165 ... ubuntu.currentseries, PackagingType.PRIME, name12)
166 >>> print_report(ubuntu.getPackagesAndPublicUpstreamBugCounts(limit=3))
167- pmount pmount 2 2 0 0
168- linux-source-2.6.15 None 1 0 0 0
169- mozilla-firefox firefox 1 1 1 1
170+ pmount pmount 2 2 0 0 0
171+ linux-source-2.6.15 None 1 0 0 0 0
172+ mozilla-firefox firefox 1 1 1 1 0
173
174 We then add an upstream task to the second pmount bug:
175
176@@ -131,20 +131,56 @@
177 >>> task = getUtility(IBugTaskSet).createTask(bug, name12, product=pmount)
178 >>> Store.of(task).flush()
179 >>> print_report(ubuntu.getPackagesAndPublicUpstreamBugCounts(limit=3))
180- pmount pmount 2 2 1 0
181- linux-source-2.6.15 None 1 0 0 0
182- mozilla-firefox firefox 1 1 1 1
183-
184-Linking that task to a bugwatch makes the watch counts update:
185+ pmount pmount 2 2 1 0 0
186+ linux-source-2.6.15 None 1 0 0 0 0
187+ mozilla-firefox firefox 1 1 1 1 0
188+
189+The last column counts those bugs with upstream tasks that have patches
190+attached but which don't have an upstream bugwatch. If we add a ordinary
191+attachment to our pmount bug, the value of the last column does not
192+change...
193+
194+ >>> attachment = factory.makeBugAttachment(bug)
195+ >>> print_report(ubuntu.getPackagesAndPublicUpstreamBugCounts(limit=3))
196+ pmount pmount 2 2 1 0 0
197+ linux-source-2.6.15 None 1 0 0 0 0
198+ mozilla-firefox firefox 1 1 1 1 0
199+
200+...but when we make this attachment a patch, the value of the column
201+increases.
202+
203+ >>> from lp.bugs.interfaces.bugattachment import BugAttachmentType
204+ >>> attachment.type = BugAttachmentType.PATCH
205+ >>> Store.of(attachment).flush()
206+ >>> print_report(ubuntu.getPackagesAndPublicUpstreamBugCounts(limit=3))
207+ pmount pmount 2 2 1 0 1
208+ linux-source-2.6.15 None 1 0 0 0 0
209+ mozilla-firefox firefox 1 1 1 1 0
210+
211+Note that we count only bugs with patches for products that do not
212+use Malone officially.
213+
214+ >>> pmount.official_malone = True
215+ >>> Store.of(pmount).flush()
216+ >>> print_report(ubuntu.getPackagesAndPublicUpstreamBugCounts(limit=3))
217+ pmount pmount 2 2 1 1 0
218+ linux-source-2.6.15 None 1 0 0 0 0
219+ mozilla-firefox firefox 1 1 1 1 0
220+
221+ >>> pmount.official_malone = False
222+ >>> Store.of(pmount).flush()
223+
224+Linking that task to a bugwatch increases the watch counts and decreases
225+the count of bugs having patches but no bug watch.
226
227 >>> url = "http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=666"
228 >>> [watch] = getUtility(IBugWatchSet).fromText(url, bug, name12)
229 >>> task.bugwatch = watch
230 >>> sync(task)
231 >>> print_report(ubuntu.getPackagesAndPublicUpstreamBugCounts(limit=3))
232- pmount pmount 2 2 1 1
233- linux-source-2.6.15 None 1 0 0 0
234- mozilla-firefox firefox 1 1 1 1
235+ pmount pmount 2 2 1 1 0
236+ linux-source-2.6.15 None 1 0 0 0 0
237+ mozilla-firefox firefox 1 1 1 1 0
238
239
240 Properties of BugReportData
241@@ -488,6 +524,7 @@
242
243 >>> print_sort_order_links(view)
244 bug_supervisor_name http://...?sort_by=bug_supervisor_name
245+ bugs_with_upstream_patches http:...?sort_by=bugs_with_upstream_patches
246 bugtracker_name http://...?sort_by=bugtracker_name
247 dsp http://...?sort_by=dsp
248 open_bugs http://...?sort_by=open_bugs
249@@ -517,6 +554,7 @@
250
251 >>> print_sort_order_links(view)
252 bug_supervisor_name http://...?sort_by=-bug_supervisor_name
253+ bugs_with_upstream_patches http:...?sort_by=bugs_with_upstream_patches
254 bugtracker_name http://...?sort_by=bugtracker_name...
255
256 Each sort_order_links dict has an 'arrow' key. This is the URL of the
257@@ -524,6 +562,7 @@
258
259 >>> print_sort_order_links(view, 'arrow')
260 bug_supervisor_name /@@/arrowUp
261+ bugs_with_upstream_patches /@@/arrowBlank
262 bugtracker_name /@@/arrowBlank
263 dsp /@@/arrowBlank
264 open_bugs /@@/arrowBlank
265@@ -552,6 +591,7 @@
266
267 >>> print_sort_order_links(view, 'arrow')
268 bug_supervisor_name /@@/arrowDown
269+ bugs_with_upstream_patches /@@/arrowBlank
270 bugtracker_name /@@/arrowBlank...
271
272 >>> form = {'sort_by': '-bugtracker_name'}
273@@ -562,6 +602,7 @@
274
275 >>> print_sort_order_links(view, 'arrow')
276 bug_supervisor_name /@@/arrowBlank
277+ bugs_with_upstream_patches /@@/arrowBlank
278 bugtracker_name /@@/arrowDown...
279
280 PS: This page is actually browser-tested in pagetests.distribution-
281
282=== modified file 'lib/lp/bugs/stories/distribution/xx-distribution-upstream-bug-report.txt'
283--- lib/lp/bugs/stories/distribution/xx-distribution-upstream-bug-report.txt 2010-01-23 14:17:49 +0000
284+++ lib/lp/bugs/stories/distribution/xx-distribution-upstream-bug-report.txt 2010-02-18 09:23:13 +0000
285@@ -43,11 +43,11 @@
286 >>> table = find_tag_by_id(browser.contents, 'upstream-report-content')
287 >>> print extract_text(table, True)
288 linux-source-2.6.15 Missing corresponding project. (find) (link)
289- 2 2 100.00 0 2 100.00 0 1 50.00 1
290+ 2 2 100.00 0 2 100.00 0 1 50.00 1 -
291 mozilla-firefox Mozilla Firefox Launchpad Unspecified
292 1 1 100.00 0 1 100.00 0
293 thunderbird Missing corresponding project. (find) (link)
294- 1 1 100.00 0 1 100.00 0 1 100.00 0
295+ 1 1 100.00 0 1 100.00 0 1 100.00 0 -
296
297 XXX kiko 2008-02-01 bug=188020: One thing to note from the counts above
298 is that while the linux-source/tomcat task is counted as pending a
299@@ -58,7 +58,7 @@
300
301 >>> table = find_tag_by_id(browser.contents, 'upstream-report-totals')
302 >>> print extract_text(table)
303- Totals: 4 4 100.00 0 4 100.00 0 3 75.00 1
304+ Totals: 4 4 100.00 0 4 100.00 0 3 75.00 1 0
305
306 This 3 in the watched column is caused by a problem similar to the
307 above; if you do a count of the values in the cells it would be 2, of
308@@ -254,11 +254,27 @@
309 >>> table = find_tag_by_id(browser.contents, 'upstream-report-content')
310 >>> print extract_text(table, True)
311 linux-source-2.6.15 Missing corresponding project. (find) (link)
312- 2 2 100.00 0 2 100.00 0 0 0.00 2
313- mozilla-firefox Mozilla Firefox The Mozilla.org Bug Tracker Unspecified
314- 1 1 100.00 0 1 100.00 0 0 0.00 1
315- thunderbird Missing corresponding project. (find) (link)
316- 1 1 100.00 0 1 100.00 0 1 100.00 0
317+ 2 2 100.00 0 2 100.00 0 0 0.00 2 -
318+ mozilla-firefox Mozilla Firefox The Mozilla.org Bug Tracker Unspecified
319+ 1 1 100.00 0 1 100.00 0 0 0.00 1 -
320+ thunderbird Missing corresponding project. (find) (link)
321+ 1 1 100.00 0 1 100.00 0 1 100.00 0 -
322+
323+If we now add an attachment to the bug we created earlier, the number
324+of bugs with patches for upstream increases for linux-source-2.6.15.
325+
326+ >>> login('foo.bar@canonical.com')
327+ >>> attachment = factory.makeBugAttachment(bug, is_patch=True)
328+ >>> logout()
329+ >>> browser.open("http://bugs.launchpad.dev/ubuntu/+upstreamreport")
330+ >>> table = find_tag_by_id(browser.contents, 'upstream-report-content')
331+ >>> print extract_text(table, True)
332+ linux-source-2.6.15 Missing corresponding project. (find) (link)
333+ 2 2 100.00 0 2 100.00 0 0 0.00 2 1
334+ mozilla-firefox Mozilla Firefox The Mozilla.org Bug Tracker Unspecified
335+ 1 1 100.00 0 1 100.00 0 0 0.00 1 -
336+ thunderbird Missing corresponding project. (find) (link)
337+ 1 1 100.00 0 1 100.00 0 1 100.00 0 -
338
339
340 The table of packages can be sorted by any of the columns. The column
341@@ -298,11 +314,11 @@
342 >>> table = find_tag_by_id(browser.contents, 'upstream-report-content')
343 >>> print extract_text(table, True)
344 mozilla-firefox Mozilla Firefox The Mozilla.org Bug Tracker Unspecified
345- 1 1 100.00 0 1 100.00 0 0 0.00 1
346+ 1 1 100.00 0 1 100.00 0 0 0.00 1 -
347 thunderbird Missing corresponding project. (find) (link)
348- 1 1 100.00 0 1 100.00 0 1 100.00 0
349+ 1 1 100.00 0 1 100.00 0 1 100.00 0 -
350 linux-source-2.6.15 Missing corresponding project. (find) (link)
351- 2 2 100.00 0 2 100.00 0 0 0.00 2
352+ 2 2 100.00 0 2 100.00 0 0 0.00 2 1
353
354 An arrow next to the current sort header tells the user in which
355 direction the table is sorted.
356@@ -324,11 +340,11 @@
357 >>> table = find_tag_by_id(browser.contents, 'upstream-report-content')
358 >>> print extract_text(table, True)
359 linux-source-2.6.15 Missing corresponding project. (find) (link)
360- 2 2 100.00 0 2 100.00 0 0 0.00 2
361+ 2 2 100.00 0 2 100.00 0 0 0.00 2 1
362 mozilla-firefox Mozilla Firefox The Mozilla.org Bug Tracker Unspecified
363- 1 1 100.00 0 1 100.00 0 0 0.00 1
364+ 1 1 100.00 0 1 100.00 0 0 0.00 1 -
365 thunderbird Missing corresponding project. (find) (link)
366- 1 1 100.00 0 1 100.00 0 1 100.00 0
367+ 1 1 100.00 0 1 100.00 0 1 100.00 0 -
368
369 Finally, you can associate default branches to products. This is done by
370 specifying a branch for the product's main_series:
371@@ -360,11 +376,11 @@
372 >>> table = find_tag_by_id(browser.contents, 'upstream-report-content')
373 >>> print extract_text(table, True)
374 mozilla-firefox Missing corresponding project. (find) (link)
375- 3 0 0.00 3 2 66.67 1 0 0.00 2
376+ 3 0 0.00 3 2 66.67 1 0 0.00 2 -
377
378 >>> table = find_tag_by_id(browser.contents, 'upstream-report-totals')
379 >>> print extract_text(table)
380- Totals: 3 0 0.00 3 2 66.67 1 0 0.00 2
381+ Totals: 3 0 0.00 3 2 66.67 1 0 0.00 2 0
382
383 >>> browser.open("http://bugs.launchpad.dev/kubuntu/+upstreamreport")
384 >>> table = find_tag_by_id(browser.contents, 'upstream-report')
385
386=== modified file 'lib/lp/bugs/templates/distribution-upstream-bug-report.pt'
387--- lib/lp/bugs/templates/distribution-upstream-bug-report.pt 2009-09-04 16:28:13 +0000
388+++ lib/lp/bugs/templates/distribution-upstream-bug-report.pt 2010-02-18 09:23:13 +0000
389@@ -131,6 +131,13 @@
390 <img id="sortarrow-watched-delta"
391 tal:attributes="src links/watched_bugs_delta/arrow" />
392 </th>
393+ <th class="amount">
394+ <a id="sort-bugs-with-upstream-patches"
395+ tal:attributes="href links/bugs_with_upstream_patches/link"
396+ >Patches for upstream</a>
397+ <img id="sortarrow-bugs-with-upstream-patches"
398+ tal:attributes="src links/bugs_with_upstream_patches/arrow" />
399+ </th>
400 </tr>
401 </thead>
402 <tbody id="upstream-report-content">
403@@ -219,7 +226,7 @@
404 </td>
405 <tal:upstream-in-launchpad
406 condition="item/official_malone">
407- <td colspan="3" class="good">&nbsp;</td>
408+ <td colspan="4" class="good">&nbsp;</td>
409 </tal:upstream-in-launchpad>
410 <tal:upstream-not-in-launchpad
411 condition="not: item/official_malone">
412@@ -231,6 +238,17 @@
413 <a tal:attributes="href item/watched_bugs_delta_url"
414 tal:content="item/watched_bugs_delta"></a>
415 </td>
416+ <td tal:attributes="class string:amount ${item/watched_bugs_class}">
417+ <tal:has-bugs-with-upstream-patches
418+ condition="item/bugs_with_upstream_patches">
419+ <a tal:attributes="href item/bugs_with_upstream_patches_url"
420+ tal:content="item/bugs_with_upstream_patches"></a>
421+ </tal:has-bugs-with-upstream-patches>
422+ <tal:has-no-bugs-with-upstream-patches
423+ condition="not: item/bugs_with_upstream_patches">
424+ -
425+ </tal:has-no-bugs-with-upstream-patches>
426+ </td>
427 </tal:upstream-not-in-launchpad>
428 </tr>
429 </tbody>
430@@ -257,6 +275,8 @@
431 tal:content="view/total/watched_bugs_percentage/fmt:float/.2" />
432 <td class="amount"
433 tal:content="view/total/watched_bugs_delta" />
434+ <td class="amount"
435+ tal:content="view/total/bugs_with_upstream_patches" />
436 </tr>
437 </tfoot>
438 </table>
439
440=== modified file 'lib/lp/registry/model/distribution.py'
441--- lib/lp/registry/model/distribution.py 2010-02-11 19:17:52 +0000
442+++ lib/lp/registry/model/distribution.py 2010-02-18 09:23:13 +0000
443@@ -34,6 +34,7 @@
444 from lp.soyuz.model.binarypackagename import BinaryPackageName
445 from lp.soyuz.model.binarypackagerelease import (
446 BinaryPackageRelease)
447+from lp.bugs.interfaces.bugattachment import BugAttachmentType
448 from lp.bugs.model.bug import (
449 BugSet, get_bug_tags, get_bug_tags_open_count)
450 from lp.bugs.model.bugtarget import (
451@@ -1375,7 +1376,14 @@
452 COUNT(DISTINCT CASE WHEN Bugtask.status in %(unresolved)s AND
453 (RelatedBugTask.bugwatch IS NOT NULL OR
454 RelatedProduct.official_malone IS TRUE) THEN
455- RelatedBugTask.bug END) AS bugs_with_upstream_bugwatch
456+ RelatedBugTask.bug END) AS bugs_with_upstream_bugwatch,
457+ COUNT(DISTINCT CASE WHEN Bugtask.status in %(unresolved)s AND
458+ RelatedBugTask.bugwatch IS NULL AND
459+ RelatedProduct.official_malone IS FALSE AND
460+ Bug.latest_patch_uploaded IS NOT NULL
461+ THEN
462+ RelatedBugTask.bug END)
463+ AS bugs_with_upstream_patches
464 FROM
465 SourcePackageName AS SPN
466 JOIN Bugtask ON SPN.id = Bugtask.sourcepackagename
467@@ -1453,7 +1461,8 @@
468 # in a reasonable data structure.
469 results = []
470 for (spn_id, spn_name, open_bugs, bugs_triaged,
471- bugs_affecting_upstream, bugs_with_upstream_bugwatch) in counts:
472+ bugs_affecting_upstream, bugs_with_upstream_bugwatch,
473+ bugs_with_upstream_patches) in counts:
474 sourcepackagename = SourcePackageName.get(spn_id)
475 dsp = self.getSourcePackage(sourcepackagename)
476 if spn_id in sources_to_products:
477@@ -1463,7 +1472,8 @@
478 product = None
479 results.append(
480 (dsp, product, open_bugs, bugs_triaged,
481- bugs_affecting_upstream, bugs_with_upstream_bugwatch))
482+ bugs_affecting_upstream, bugs_with_upstream_bugwatch,
483+ bugs_with_upstream_patches))
484 return results
485
486 def setBugSupervisor(self, bug_supervisor, user):

Subscribers

People subscribed via source and target branches

to status/vote changes: