Merge lp:~wgrant/launchpad/bugsummary-v2-app-no-fixed-upstream into lp:launchpad

Proposed by William Grant
Status: Merged
Merged at revision: 15277
Proposed branch: lp:~wgrant/launchpad/bugsummary-v2-app-no-fixed-upstream
Merge into: lp:launchpad
Diff against target: 871 lines (+87/-500)
10 files modified
lib/lp/bugs/browser/bugtask.py (+5/-14)
lib/lp/bugs/browser/tests/special/bugs-fixed-elsewhere.txt (+0/-144)
lib/lp/bugs/browser/tests/test_bugs_fixed_elsewhere.py (+0/-73)
lib/lp/bugs/doc/bugsummary.txt (+69/-72)
lib/lp/bugs/interfaces/bugsummary.py (+0/-1)
lib/lp/bugs/model/bugsummary.py (+0/-1)
lib/lp/bugs/model/tests/test_bugsummary.py (+0/-137)
lib/lp/bugs/stories/xx-bugs-statistics-portlet.txt (+12/-39)
lib/lp/bugs/templates/bugtarget-portlet-bugfilters-content.pt (+1/-12)
lib/lp/services/features/flags.py (+0/-7)
To merge this branch: bzr merge lp:~wgrant/launchpad/bugsummary-v2-app-no-fixed-upstream
Reviewer Review Type Date Requested Status
Ian Booth (community) Approve
Review via email: mp+106557@code.launchpad.net

Commit message

Completely drop the 'Bugs fixed elsewhere' count and remove BugSummary.fixed_upstream from the model.

Description of the change

This branch continues bug #950502, completely removing the application side of the "Bugs fixed elsewhere" count that has been disabled on production for two months. BugSummary.fixed_upstream support gets ripped out of the model, in preparation for its purging from the DB next week.

To post a comment you must log in.
Revision history for this message
Ian Booth (wallyworld) wrote :

Looks fine.

review: Approve

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 2012-05-01 07:24:59 +0000
3+++ lib/lp/bugs/browser/bugtask.py 2012-05-21 03:40:21 +0000
4@@ -1977,8 +1977,8 @@
5 # Circular fail.
6 from lp.bugs.model.bugsummary import BugSummary
7 bug_task_set = getUtility(IBugTaskSet)
8- groups = (BugSummary.status, BugSummary.importance,
9- BugSummary.has_patch, BugSummary.fixed_upstream)
10+ groups = (
11+ BugSummary.status, BugSummary.importance, BugSummary.has_patch)
12 counts = bug_task_set.countBugs(self.user, [self.context], groups)
13 # Sum the split out aggregates.
14 new = 0
15@@ -1987,12 +1987,10 @@
16 critical = 0
17 high = 0
18 with_patch = 0
19- resolved_upstream = 0
20 for metadata, count in counts.items():
21 status = metadata[0]
22 importance = metadata[1]
23 has_patch = metadata[2]
24- was_resolved_upstream = metadata[3]
25 if status == BugTaskStatus.NEW:
26 new += count
27 elif status == BugTaskStatus.INPROGRESS:
28@@ -2003,20 +2001,13 @@
29 high += count
30 if has_patch and DISPLAY_BUG_STATUS_FOR_PATCHES[status]:
31 with_patch += count
32- if was_resolved_upstream:
33- resolved_upstream += count
34 open += count
35- result = dict(new=new, open=open, inprogress=inprogress, high=high,
36- critical=critical, with_patch=with_patch,
37- resolved_upstream=resolved_upstream)
38+ result = dict(
39+ new=new, open=open, inprogress=inprogress, high=high,
40+ critical=critical, with_patch=with_patch)
41 return result
42
43 @property
44- def bugs_fixed_elsewhere_count(self):
45- """A count of bugs fixed elsewhere."""
46- return self._bug_stats['resolved_upstream']
47-
48- @property
49 def open_cve_bugs_count(self):
50 """A count of open bugs linked to CVEs."""
51 params = get_default_search_params(self.user)
52
53=== removed file 'lib/lp/bugs/browser/tests/special/bugs-fixed-elsewhere.txt'
54--- lib/lp/bugs/browser/tests/special/bugs-fixed-elsewhere.txt 2012-04-04 05:46:26 +0000
55+++ lib/lp/bugs/browser/tests/special/bugs-fixed-elsewhere.txt 1970-01-01 00:00:00 +0000
56@@ -1,144 +0,0 @@
57-Bugs Fixed Elsewhere
58-====================
59-
60-The +bugtarget-portlet-bugfilters-info view for a distribution or
61-product contains a property for a URL to a list of bugs fixed
62-elsewhere.
63-
64- >>> from zope.component import getMultiAdapter
65- >>> from lp.services.webapp.servers import LaunchpadTestRequest
66-
67- >>> view = getMultiAdapter(
68- ... (bugtarget, LaunchpadTestRequest()),
69- ... name='+bugtarget-portlet-bugfilters-info')
70- >>> view.initialize()
71-
72- >>> view.bugs_fixed_elsewhere_url
73- u'http://.../+bugs?field.status_upstream=resolved_upstream'
74-
75-The +bugtarget-portlet-bugfilters-stats view for a distribution or
76-product contains the URL as above in addition to a count of how many
77-bugs that are fixed elsewhere. This count can take a while to
78-calculate, so it is put on this separate view which can be requested
79-asyncronously.
80-
81- >>> def get_view():
82- ... view = getMultiAdapter(
83- ... (bugtarget, LaunchpadTestRequest()),
84- ... name='+bugtarget-portlet-bugfilters-stats')
85- ... view.initialize()
86- ... return view
87-
88- >>> view = get_view()
89- >>> view.bugs_fixed_elsewhere_url
90- u'http://.../+bugs?field.status_upstream=resolved_upstream'
91- >>> view.bugs_fixed_elsewhere_count
92- 0
93-
94-Simply opening a bug elsewhere won't increase the count.
95-
96- >>> from lp.registry.interfaces.product import IProductSet
97- >>> evolution = getUtility(IProductSet).getByName('evolution')
98- >>> evolution != bugtarget
99- True
100-
101- >>> bug = filebug(bugtarget, 'Example Bug')
102-
103- >>> from lp.bugs.interfaces.bugtask import IBugTaskSet
104- >>> elsewhere = getUtility(IBugTaskSet).createTask(
105- ... bug, getUtility(ILaunchBag).user, evolution)
106- >>> get_view().bugs_fixed_elsewhere_count
107- 0
108-
109-But if we mark the bug as fixed in the other, the count will increase
110-by one.
111-
112- >>> from lp.bugs.interfaces.bugtask import BugTaskStatus
113- >>> elsewhere.transitionToStatus(
114- ... BugTaskStatus.FIXRELEASED, getUtility(ILaunchBag).user)
115-
116- >>> get_view().bugs_fixed_elsewhere_count
117- 1L
118-
119-Bugs fixed elsewhere also show up when we perform an advanced bug
120-search, using the appropriate query string parameter to ask for "bugs
121-resolved elsewhere":
122-
123- >>> search_view = getMultiAdapter(
124- ... (bugtarget,
125- ... LaunchpadTestRequest(
126- ... form={'field.status_upstream': 'resolved_upstream'})),
127- ... name='+bugs')
128- >>> search_view.initialize()
129- >>> navigator = search_view.search()
130-
131- >>> for task in search_view.search().batch:
132- ... for related_task in task.related_tasks:
133- ... print related_task.target.name
134- ... print related_task.status.name
135- evolution
136- FIXRELEASED
137-
138-
139-Private Bugs
140-------------
141-
142-Only bugs that the user has permission to view are included in the count.
143-
144- >>> another_bug = filebug(bugtarget, 'Example Bug')
145- >>> another_bug.setPrivate(True, getUtility(ILaunchBag).user)
146- True
147-
148- >>> another_elsewhere = getUtility(IBugTaskSet).createTask(
149- ... another_bug, getUtility(ILaunchBag).user, evolution)
150- >>> another_elsewhere.transitionToStatus(
151- ... BugTaskStatus.FIXRELEASED, getUtility(ILaunchBag).user)
152-
153- >>> get_view().bugs_fixed_elsewhere_count
154- 2L
155-
156-This means that No Privileges Person will see that there is only one bug
157-fixed elsewhere.
158-
159- >>> login('no-priv@canonical.com')
160- >>> get_view().bugs_fixed_elsewhere_count
161- 1L
162-
163-If the private bug is made public again, he will of course see that
164-there are two bugs fixed.
165-
166- >>> login('foo.bar@canonical.com')
167- >>> another_bug.setPrivate(False, getUtility(ILaunchBag).user)
168- True
169-
170- >>> login('no-priv@canonical.com')
171- >>> get_view().bugs_fixed_elsewhere_count
172- 2L
173-
174-
175-Duplicate Bugs
176---------------
177-
178-Bugs that are duplicate of other bugs aren't included in the count.
179-
180- >>> another_bug.markAsDuplicate(bug)
181-
182- >>> get_view().bugs_fixed_elsewhere_count
183- 1L
184-
185-
186-Resolved Bugs
187--------------
188-
189-The count includes only bugs that are open in the current context.
190-
191- >>> for bugtask in bug.bugtasks:
192- ... if bugtask.target == bugtarget:
193- ... break
194- ... else:
195- ... print "Couldn't find a bugtasks for %r" % bugtarget
196- >>> bugtask.transitionToStatus(
197- ... BugTaskStatus.FIXRELEASED, getUtility(ILaunchBag).user)
198-
199- >>> get_view().bugs_fixed_elsewhere_count
200- 0
201
202=== removed file 'lib/lp/bugs/browser/tests/test_bugs_fixed_elsewhere.py'
203--- lib/lp/bugs/browser/tests/test_bugs_fixed_elsewhere.py 2011-12-30 06:14:56 +0000
204+++ lib/lp/bugs/browser/tests/test_bugs_fixed_elsewhere.py 1970-01-01 00:00:00 +0000
205@@ -1,73 +0,0 @@
206-# Copyright 2009 Canonical Ltd. This software is licensed under the
207-# GNU Affero General Public License version 3 (see the file LICENSE).
208-
209-"""Test harness for running the bugs-fixed-elsewhere.txt tests."""
210-
211-__metaclass__ = type
212-
213-__all__ = []
214-
215-import unittest
216-
217-from zope.component import getUtility
218-
219-from lp.bugs.interfaces.bug import CreateBugParams
220-from lp.bugs.interfaces.bugtask import BugTaskStatus
221-from lp.registry.interfaces.distribution import IDistributionSet
222-from lp.registry.interfaces.product import IProductSet
223-from lp.services.database.sqlbase import (
224- cursor,
225- sqlvalues,
226- )
227-from lp.services.webapp.interfaces import ILaunchBag
228-from lp.testing import login
229-from lp.testing.layers import LaunchpadFunctionalLayer
230-from lp.testing.systemdocs import (
231- LayeredDocFileSuite,
232- setUp,
233- tearDown,
234- )
235-
236-
237-def bugtarget_filebug(bugtarget, summary):
238- """File a bug as the current user on the bug target and return it."""
239- return bugtarget.createBug(CreateBugParams(
240- getUtility(ILaunchBag).user, summary, comment=summary))
241-
242-def commonSetUp(test):
243- """Set up common for all tests."""
244- setUp(test)
245- test.globs['filebug'] = bugtarget_filebug
246- login('test@canonical.com')
247- # Ensure that there are no fixed bugs in sample data that might
248- # interfere with the tests.
249- cur = cursor()
250- cur.execute("UPDATE BugTask SET status = %s" % (
251- sqlvalues(BugTaskStatus.NEW)))
252-
253-
254-def productSetUp(test):
255- commonSetUp(test)
256- test.globs['bugtarget'] = getUtility(IProductSet).getByName('firefox')
257-
258-
259-def distributionSetUp(test):
260- commonSetUp(test)
261- test.globs['bugtarget'] = getUtility(IDistributionSet).getByName('ubuntu')
262-
263-
264-def test_suite():
265- suite = unittest.TestSuite()
266-
267- setUpMethods = [
268- productSetUp,
269- distributionSetUp,
270- ]
271-
272- for setUpMethod in setUpMethods:
273- test = LayeredDocFileSuite(
274- 'special/bugs-fixed-elsewhere.txt',
275- setUp=setUpMethod, tearDown=tearDown,
276- layer=LaunchpadFunctionalLayer)
277- suite.addTest(test)
278- return suite
279
280=== modified file 'lib/lp/bugs/doc/bugsummary.txt'
281--- lib/lp/bugs/doc/bugsummary.txt 2012-05-02 05:25:11 +0000
282+++ lib/lp/bugs/doc/bugsummary.txt 2012-05-21 03:40:21 +0000
283@@ -14,20 +14,19 @@
284 - milestone
285 - importance
286 - has_patch
287- - fixed_upstream
288
289
290 First we should setup some helpers to use in the examples. These will
291 let us dump the BugSummary table in a readable format.
292
293 ---------------------------------------------------------------
294- prod ps dist ds spn tag mile status import pa up vis #
295+ prod ps dist ds spn tag mile status import pa vis #
296 ---------------------------------------------------------------
297
298 The columns are product, productseries, distribution, distroseries,
299 sourcepackagename, tag, milestone, status, importance, has_patch,
300-fixed_upstream, viewed_by and the count. viewed_by is a team reference
301-and used to query private bug counts.
302+viewed_by and the count. viewed_by is a team reference and used to
303+query private bug counts.
304
305 >>> from lp.services.database.lpstorm import IMasterStore
306 >>> from lp.bugs.interfaces.bugtask import BugTaskStatus
307@@ -60,14 +59,13 @@
308 ... BugSummary.sourcepackagename_id, BugSummary.tag,
309 ... BugSummary.milestone_id, BugSummary.status,
310 ... BugSummary.importance, BugSummary.has_patch,
311- ... BugSummary.fixed_upstream, BugSummary.viewed_by_id,
312- ... BugSummary.id)
313+ ... BugSummary.viewed_by_id, BugSummary.id)
314 ... fmt = (
315 ... "%-4s %-4s %-4s %-4s %-5s %-3s %-4s "
316- ... "%-6s %-6s %-2s %-2s %-4s %3s")
317+ ... "%-6s %-6s %-2s %-4s %3s")
318 ... header = fmt % (
319 ... 'prod', 'ps', 'dist', 'ds', 'spn', 'tag', 'mile',
320- ... 'status', 'import', 'pa', 'up', 'vis', '#')
321+ ... 'status', 'import', 'pa', 'vis', '#')
322 ... print "-" * len(header)
323 ... print header
324 ... print "-" * len(header)
325@@ -83,7 +81,6 @@
326 ... str(bugsummary.status)[:6],
327 ... str(bugsummary.importance)[:6],
328 ... str(bugsummary.has_patch)[:1],
329- ... str(bugsummary.fixed_upstream)[:1],
330 ... name(bugsummary.viewed_by),
331 ... bugsummary.count)
332 ... print " " * (len(header) - 4),
333@@ -122,12 +119,12 @@
334 ... BugSummary.tag == None)
335
336 >>> print_result(bug_summaries)
337- ---------------------------------------------------------------
338- prod ps dist ds spn tag mile status import pa up vis #
339- ---------------------------------------------------------------
340- pr-a x x x x x x New Undeci F F x 1
341- ===
342- 1
343+ ------------------------------------------------------------
344+ prod ps dist ds spn tag mile status import pa vis #
345+ ------------------------------------------------------------
346+ pr-a x x x x x x New Undeci F x 1
347+ ===
348+ 1
349
350 There is one row per tag per combination of product, status and milestone.
351 If we are interested in all bugs targeted to a product regardless of how
352@@ -148,13 +145,13 @@
353 ... BugSummary.product == prod_a,
354 ... BugSummary.tag == None,
355 ... BugSummary.viewed_by == None)
356- ---------------------------------------------------------------
357- prod ps dist ds spn tag mile status import pa up vis #
358- ---------------------------------------------------------------
359- pr-a x x x x x x New Undeci F F x 2
360- pr-a x x x x x x Confir Undeci F F x 2
361- ===
362- 4
363+ ------------------------------------------------------------
364+ prod ps dist ds spn tag mile status import pa vis #
365+ ------------------------------------------------------------
366+ pr-a x x x x x x New Undeci F x 2
367+ pr-a x x x x x x Confir Undeci F x 2
368+ ===
369+ 4
370
371 Here are the rows associated with the 't-a' tag. There is 1 Confirmed
372 bug task targetted to the pr-a product who's bug is tagged 't-a'.:
373@@ -163,12 +160,12 @@
374 ... BugSummary.product == prod_a,
375 ... BugSummary.tag == u't-a',
376 ... BugSummary.viewed_by == None)
377- ---------------------------------------------------------------
378- prod ps dist ds spn tag mile status import pa up vis #
379- ---------------------------------------------------------------
380- pr-a x x x x t-a x Confir Undeci F F x 1
381- ===
382- 1
383+ ------------------------------------------------------------
384+ prod ps dist ds spn tag mile status import pa vis #
385+ ------------------------------------------------------------
386+ pr-a x x x x t-a x Confir Undeci F x 1
387+ ===
388+ 1
389
390 You will normally want to get the total count counted in the database
391 rather than waste transmission time to calculate the rows client side.
392@@ -208,17 +205,17 @@
393 >>> print_find(
394 ... BugSummary.product == prod_a,
395 ... BugSummary.viewed_by == None)
396- ---------------------------------------------------------------
397- prod ps dist ds spn tag mile status import pa up vis #
398- ---------------------------------------------------------------
399- pr-a x x x x t-a x Confir Undeci F F x 1
400- pr-a x x x x t-b ms-a New Undeci F F x 1
401- pr-a x x x x t-c ms-a New Undeci F F x 1
402- pr-a x x x x x ms-a New Undeci F F x 1
403- pr-a x x x x x x New Undeci F F x 2
404- pr-a x x x x x x Confir Undeci F F x 2
405- ===
406- 8
407+ ------------------------------------------------------------
408+ prod ps dist ds spn tag mile status import pa vis #
409+ ------------------------------------------------------------
410+ pr-a x x x x t-a x Confir Undeci F x 1
411+ pr-a x x x x t-b ms-a New Undeci F x 1
412+ pr-a x x x x t-c ms-a New Undeci F x 1
413+ pr-a x x x x x ms-a New Undeci F x 1
414+ pr-a x x x x x x New Undeci F x 2
415+ pr-a x x x x x x Confir Undeci F x 2
416+ ===
417+ 8
418
419 Number of New bugs not targeted to a milestone. Note the difference
420 between selecting records where tag is None, and where milestone is None:
421@@ -272,13 +269,13 @@
422 ... BugSummary.productseries == productseries_b,
423 ... BugSummary.product == prod_b),
424 ... BugSummary.viewed_by == None)
425- ---------------------------------------------------------------
426- prod ps dist ds spn tag mile status import pa up vis #
427- ---------------------------------------------------------------
428- pr-b x x x x x x New Undeci F F x 1
429- x ps-b x x x x x New Undeci F F x 1
430- ===
431- 2
432+ ------------------------------------------------------------
433+ prod ps dist ds spn tag mile status import pa vis #
434+ ------------------------------------------------------------
435+ pr-b x x x x x x New Undeci F x 1
436+ x ps-b x x x x x New Undeci F x 1
437+ ===
438+ 2
439
440 Distribution Bug Counts
441 -----------------------
442@@ -300,14 +297,14 @@
443 >>> print_find(
444 ... BugSummary.distribution == distribution,
445 ... BugSummary.viewed_by == None)
446- ---------------------------------------------------------------
447- prod ps dist ds spn tag mile status import pa up vis #
448- ---------------------------------------------------------------
449- x x di-a x sp-a x x New Undeci F F x 1
450- x x di-a x x x x New Undeci F F x 1
451- x x di-a x x x x Confir Undeci F F x 1
452- ===
453- 3
454+ ------------------------------------------------------------
455+ prod ps dist ds spn tag mile status import pa vis #
456+ ------------------------------------------------------------
457+ x x di-a x sp-a x x New Undeci F x 1
458+ x x di-a x x x x New Undeci F x 1
459+ x x di-a x x x x Confir Undeci F x 1
460+ ===
461+ 3
462
463 How many bugs targeted to a distribution?
464
465@@ -372,12 +369,12 @@
466 >>> print_find(
467 ... BugSummary.distroseries == series_c,
468 ... BugSummary.viewed_by == None)
469- ---------------------------------------------------------------
470- prod ps dist ds spn tag mile status import pa up vis #
471- ---------------------------------------------------------------
472- x x x ds-c x x x New Undeci F F x 1
473- ===
474- 1
475+ ------------------------------------------------------------
476+ prod ps dist ds spn tag mile status import pa vis #
477+ ------------------------------------------------------------
478+ x x x ds-c x x x New Undeci F x 1
479+ ===
480+ 1
481
482
483 Privacy
484@@ -444,18 +441,18 @@
485 ... BugSummary.distribution == distro_p,
486 ... BugSummary.distroseries == series_p)
487 >>> print_find(distro_or_series)
488- ---------------------------------------------------------------
489- prod ps dist ds spn tag mile status import pa up vis #
490- ---------------------------------------------------------------
491- x x di-p x x x x New Undeci F F p-b 1
492- x x di-p x x x x New Undeci F F own 3
493- x x di-p x x x x New Undeci F F t-a 1
494- x x di-p x x x x New Undeci F F t-c 1
495- x x di-p x x x x New Undeci F F x 1
496- x x x ds-p x x x New Undeci F F own 1
497- x x x ds-p x x x New Undeci F F t-c 1
498- ===
499- 9
500+ ------------------------------------------------------------
501+ prod ps dist ds spn tag mile status import pa vis #
502+ ------------------------------------------------------------
503+ x x di-p x x x x New Undeci F p-b 1
504+ x x di-p x x x x New Undeci F own 3
505+ x x di-p x x x x New Undeci F t-a 1
506+ x x di-p x x x x New Undeci F t-c 1
507+ x x di-p x x x x New Undeci F x 1
508+ x x x ds-p x x x New Undeci F own 1
509+ x x x ds-p x x x New Undeci F t-c 1
510+ ===
511+ 9
512
513 So how many public bugs are there on the distro?
514
515
516=== modified file 'lib/lp/bugs/interfaces/bugsummary.py'
517--- lib/lp/bugs/interfaces/bugsummary.py 2011-12-24 16:54:44 +0000
518+++ lib/lp/bugs/interfaces/bugsummary.py 2012-05-21 03:40:21 +0000
519@@ -72,7 +72,6 @@
520 viewed_by = Object(IPerson, readonly=True)
521
522 has_patch = Bool(readonly=True)
523- fixed_upstream = Bool(readonly=True)
524
525
526 class IBugSummaryDimension(Interface):
527
528=== modified file 'lib/lp/bugs/model/bugsummary.py'
529--- lib/lp/bugs/model/bugsummary.py 2011-12-30 06:14:56 +0000
530+++ lib/lp/bugs/model/bugsummary.py 2012-05-21 03:40:21 +0000
531@@ -78,7 +78,6 @@
532 viewed_by = Reference(viewed_by_id, Person.id)
533
534 has_patch = Bool()
535- fixed_upstream = Bool()
536
537
538 class CombineBugSummaryConstraint:
539
540=== modified file 'lib/lp/bugs/model/tests/test_bugsummary.py'
541--- lib/lp/bugs/model/tests/test_bugsummary.py 2012-05-02 05:25:11 +0000
542+++ lib/lp/bugs/model/tests/test_bugsummary.py 2012-05-21 03:40:21 +0000
543@@ -976,143 +976,6 @@
544 BugSummary.milestone == milestone),
545 0)
546
547- def test_fixUpstream(self):
548- distribution = self.factory.makeDistribution()
549- product = self.factory.makeProduct()
550- distro_bugtask = self.factory.makeBugTask(target=distribution)
551- bug = distro_bugtask.bug
552- product_bugtask = self.factory.makeBugTask(bug=bug, target=product)
553-
554- self.assertEqual(
555- self.getPublicCount(
556- BugSummary.distribution == distribution,
557- BugSummary.fixed_upstream == True),
558- 0)
559- self.assertEqual(
560- self.getPublicCount(
561- BugSummary.distribution == distribution,
562- BugSummary.fixed_upstream == False),
563- 1)
564-
565- product_bugtask.transitionToStatus(
566- BugTaskStatus.FIXRELEASED, bug.owner)
567-
568- self.assertEqual(
569- self.getPublicCount(
570- BugSummary.distribution == distribution,
571- BugSummary.fixed_upstream == True),
572- 1)
573- self.assertEqual(
574- self.getPublicCount(
575- BugSummary.distribution == distribution,
576- BugSummary.fixed_upstream == False),
577- 0)
578-
579- def test_breakUpstream(self):
580- distribution = self.factory.makeDistribution()
581- product = self.factory.makeProduct()
582- distro_bugtask = self.factory.makeBugTask(target=distribution)
583- bug = distro_bugtask.bug
584- product_bugtask = self.factory.makeBugTask(bug=bug, target=product)
585-
586- product_bugtask.transitionToStatus(
587- BugTaskStatus.FIXCOMMITTED, bug.owner)
588-
589- self.assertEqual(
590- self.getPublicCount(
591- BugSummary.distribution == distribution,
592- BugSummary.fixed_upstream == True),
593- 1)
594- self.assertEqual(
595- self.getPublicCount(
596- BugSummary.distribution == distribution,
597- BugSummary.fixed_upstream == False),
598- 0)
599-
600- product_bugtask.transitionToStatus(
601- BugTaskStatus.INPROGRESS, bug.owner)
602-
603- self.assertEqual(
604- self.getPublicCount(
605- BugSummary.distribution == distribution,
606- BugSummary.fixed_upstream == True),
607- 0)
608- self.assertEqual(
609- self.getPublicCount(
610- BugSummary.distribution == distribution,
611- BugSummary.fixed_upstream == False),
612- 1)
613-
614- def test_fixUpstreamViaWatch(self):
615- distribution = self.factory.makeDistribution()
616- product = self.factory.makeProduct()
617- distro_bugtask = self.factory.makeBugTask(target=distribution)
618- bug = distro_bugtask.bug
619- product_bugtask = self.factory.makeBugTask(bug=bug, target=product)
620- self.factory.makeBugWatch(bug_task=product_bugtask)
621-
622- self.assertEqual(
623- self.getPublicCount(
624- BugSummary.distribution == distribution,
625- BugSummary.fixed_upstream == True),
626- 0)
627- self.assertEqual(
628- self.getPublicCount(
629- BugSummary.distribution == distribution,
630- BugSummary.fixed_upstream == False),
631- 1)
632-
633- # Bugs flagged INVALID by upstream count as fixed upstream.
634- product_bugtask.transitionToStatus(
635- BugTaskStatus.INVALID, bug.owner)
636-
637- self.assertEqual(
638- self.getPublicCount(
639- BugSummary.distribution == distribution,
640- BugSummary.fixed_upstream == True),
641- 1)
642- self.assertEqual(
643- self.getPublicCount(
644- BugSummary.distribution == distribution,
645- BugSummary.fixed_upstream == False),
646- 0)
647-
648- def test_breakUpstreamViaWatch(self):
649- distribution = self.factory.makeDistribution()
650- product = self.factory.makeProduct()
651- distro_bugtask = self.factory.makeBugTask(target=distribution)
652- bug = distro_bugtask.bug
653- product_bugtask = self.factory.makeBugTask(bug=bug, target=product)
654- self.factory.makeBugWatch(bug_task=product_bugtask)
655-
656- product_bugtask.transitionToStatus(
657- BugTaskStatus.FIXCOMMITTED, bug.owner)
658-
659- self.assertEqual(
660- self.getPublicCount(
661- BugSummary.distribution == distribution,
662- BugSummary.fixed_upstream == True),
663- 1)
664- self.assertEqual(
665- self.getPublicCount(
666- BugSummary.distribution == distribution,
667- BugSummary.fixed_upstream == False),
668- 0)
669-
670- product_bugtask.transitionToStatus(
671- BugTaskStatus.UNKNOWN, bug.owner)
672-
673- self.assertEqual(
674- self.getPublicCount(
675- BugSummary.distribution == distribution,
676- BugSummary.fixed_upstream == True),
677- 0)
678- self.assertEqual(
679- self.getPublicCount(
680- BugSummary.distribution == distribution,
681- BugSummary.fixed_upstream == False),
682- 1)
683-
684 def test_addPatch(self):
685 product = self.factory.makeProduct()
686 bug = self.factory.makeBug(product=product)
687
688=== modified file 'lib/lp/bugs/stories/xx-bugs-statistics-portlet.txt'
689--- lib/lp/bugs/stories/xx-bugs-statistics-portlet.txt 2012-03-15 05:55:42 +0000
690+++ lib/lp/bugs/stories/xx-bugs-statistics-portlet.txt 2012-05-21 03:40:21 +0000
691@@ -37,7 +37,7 @@
692 0 Critical bugs
693 0 High importance bugs
694 <BLANKLINE>
695- 0 Bugs fixed elsewhere
696+ Bugs fixed elsewhere
697 0 Bugs with patches
698 2 Open CVE bugs - CVE reports
699
700@@ -71,7 +71,7 @@
701 0 Bugs reported by me
702 Bugs affecting me
703 <BLANKLINE>
704- 0 Bugs fixed elsewhere
705+ Bugs fixed elsewhere
706 0 Bugs with patches
707 2 Open CVE bugs - CVE reports
708
709@@ -107,7 +107,7 @@
710 0 Critical bugs
711 0 High importance bugs
712 <BLANKLINE>
713- 0 Bugs fixed elsewhere
714+ Bugs fixed elsewhere
715 0 Bugs with patches
716 1 Open CVE bug - CVE report
717
718@@ -140,7 +140,7 @@
719 0 Bugs reported by me
720 Bugs affecting me
721 <BLANKLINE>
722- 0 Bugs fixed elsewhere
723+ Bugs fixed elsewhere
724 0 Bugs with patches
725 1 Open CVE bug - CVE report
726
727@@ -175,7 +175,7 @@
728 0 Critical bugs
729 0 High importance bugs
730 <BLANKLINE>
731- 0 Bugs fixed elsewhere
732+ Bugs fixed elsewhere
733 0 Bugs with patches
734 2 Open CVE bugs
735
736@@ -208,7 +208,7 @@
737 0 Bugs reported by me
738 Bugs affecting me
739 <BLANKLINE>
740- 0 Bugs fixed elsewhere
741+ Bugs fixed elsewhere
742 0 Bugs with patches
743 2 Open CVE bugs
744
745@@ -247,7 +247,7 @@
746 0 Critical bugs
747 0 High importance bugs
748 <BLANKLINE>
749- 0 Bugs fixed elsewhere
750+ Bugs fixed elsewhere
751 0 Bugs with patches
752 1 Open CVE bug
753
754@@ -280,7 +280,7 @@
755 0 Bugs reported by me
756 Bugs affecting me
757 <BLANKLINE>
758- 0 Bugs fixed elsewhere
759+ Bugs fixed elsewhere
760 0 Bugs with patches
761 1 Open CVE bug
762
763@@ -318,7 +318,7 @@
764 1 Critical bug
765 0 High importance bugs
766 <BLANKLINE>
767- 0 Bugs fixed elsewhere
768+ Bugs fixed elsewhere
769 0 Bugs with patches
770 1 Open CVE bug
771
772@@ -352,7 +352,7 @@
773 0 Bugs reported by me
774 Bugs affecting me
775 <BLANKLINE>
776- 0 Bugs fixed elsewhere
777+ Bugs fixed elsewhere
778 0 Bugs with patches
779 1 Open CVE bug
780
781@@ -390,7 +390,7 @@
782 1 Critical bug
783 0 High importance bugs
784 <BLANKLINE>
785- 0 Bugs fixed elsewhere
786+ Bugs fixed elsewhere
787 0 Bugs with patches
788 1 Open CVE bug - CVE report
789
790@@ -424,7 +424,7 @@
791 0 Bugs reported by me
792 Bugs affecting me
793 <BLANKLINE>
794- 0 Bugs fixed elsewhere
795+ Bugs fixed elsewhere
796 0 Bugs with patches
797 1 Open CVE bug - CVE report
798
799@@ -433,30 +433,3 @@
800
801 >>> print user_browser.getLink('CVE report').url
802 http://bugs.launchpad.dev/firefox/+cve
803-
804-
805-Hiding "Bugs fixed elsewhere" counts
806-------------------------------------
807-
808-The count of bugs fixed elsewhere is of dubious utility, and it's
809-expensive to calculate when generating BugSummary. As a trial before we
810-remove it, there's a feature flag to hide the count.
811-
812- >>> print_bugfilters_portlet_filled(user_browser, path)
813- 3 New bugs
814- ...
815- <BLANKLINE>
816- 0 Bugs fixed elsewhere
817- 0 Bugs with patches
818- ...
819-
820- >>> from lp.services.features.testing import FeatureFixture
821- >>> with FeatureFixture(
822- ... {'bugs.statistics_portlet.hide_fixed_elsewhere_count': 'true'}):
823- ... print print_bugfilters_portlet_filled(user_browser, path)
824- 3 New bugs
825- ...
826- <BLANKLINE>
827- Bugs fixed elsewhere
828- 0 Bugs with patches
829- ...
830
831=== modified file 'lib/lp/bugs/templates/bugtarget-portlet-bugfilters-content.pt'
832--- lib/lp/bugs/templates/bugtarget-portlet-bugfilters-content.pt 2012-03-14 13:19:43 +0000
833+++ lib/lp/bugs/templates/bugtarget-portlet-bugfilters-content.pt 2012-05-21 03:40:21 +0000
834@@ -110,18 +110,7 @@
835
836 <tr><td colspan="2"><br /></td></tr>
837
838- <tr tal:condition="not: request/features/bugs.statistics_portlet.hide_fixed_elsewhere_count"
839- tal:define="count view/bugs_fixed_elsewhere_count|nothing;
840- plural string: Bugs fixed elsewhere;
841- singular string: Bug fixed elsewhere;">
842- <td class="bugs-count" tal:content="count" />
843- <td class="bugs-link">
844- <a tal:attributes="href string:${view/bugs_fixed_elsewhere_url}">
845- <metal:message use-macro="context/@@+base-layout-macros/plural-message"/>
846- </a>
847- </td>
848- </tr>
849- <tr tal:condition="request/features/bugs.statistics_portlet.hide_fixed_elsewhere_count">
850+ <tr>
851 <tal:comment condition="nothing">
852 No count here, because generating it is expensive.
853 </tal:comment>
854
855=== modified file 'lib/lp/services/features/flags.py'
856--- lib/lp/services/features/flags.py 2012-05-08 01:31:10 +0000
857+++ lib/lp/services/features/flags.py 2012-05-21 03:40:21 +0000
858@@ -96,13 +96,6 @@
859 '',
860 '',
861 ''),
862- ('bugs.statistics_portlet.hide_fixed_elsewhere_count',
863- 'boolean',
864- ('Hides the "Bugs fixed elsewhere" count in the bug target statistics '
865- 'portlet.'),
866- '',
867- '',
868- ''),
869 ('code.ajax_revision_diffs.enabled',
870 'boolean',
871 ("Offer expandable inline diffs for branch revisions."),