Merge lp:~sinzui/launchpad/delete-conjoined-bugtask-1 into lp:launchpad

Proposed by Curtis Hovey
Status: Merged
Merged at revision: 11356
Proposed branch: lp:~sinzui/launchpad/delete-conjoined-bugtask-1
Merge into: lp:launchpad
Diff against target: 24 lines (+2/-1)
2 files modified
lib/lp/registry/browser/__init__.py (+1/-1)
lib/lp/registry/browser/tests/test_milestone.py (+1/-0)
To merge this branch: bzr merge lp:~sinzui/launchpad/delete-conjoined-bugtask-1
Reviewer Review Type Date Requested Status
Guilherme Salgado (community) code Approve
Review via email: mp+32796@code.launchpad.net

Description of the change

This is my branch to correct deletion of bugtasks during milestone deletion.

    lp:~sinzui/launchpad/delete-conjoined-bugtask-1
    Diff size: 25
    Launchpad bug:
          https://bugs.launchpad.net/bugs/522599
    Test command: ./bin/test -vv -t TestMilestoneDeleteView
    Pre-implementation: EdwinGrubbs
    Target release: 10.09

correct deletion of bugtasks during milestone deletion
--------------------------------------------------------------------

The fix to permit users to delete milestones with conjoined bugs is bad.
The slave was deleted in my QA on edge, but we wanted to delete the master.
ie. https://bugs.edge.launchpad.net/gdp/trunk/+bug/420173 shows a master bug
without a slave. The master is targeted to a series, which make no sense since
there is no bug in the project. This may require SQL to fix.

This bad chunk:
            if bugtask.conjoined_master is not None:
                Store.of(bugtask).remove(bugtask)

Rules
-----

    * Correct the line of code.
            if bugtask.conjoined_master is not None:
                Store.of(bugtask).remove(bugtask.conjoined_master)
    * Revise the test to verify that the productseries has no bugtasks.

QA
--

    * Create a milestone you intend to delete on /gdp/trunk
    * Target https://bugs.edge.launchpad.net/gdp/trunk/+bug/420173
      to the milestone.
    * Delete the milestone.
    * Verify The trunk bugtask is gone and that you can see the status
      of the project bugtask.

Lint
----

Linting changed files:
  lib/lp/registry/browser/__init__.py
  lib/lp/registry/browser/tests/test_milestone.py

Test
----

    * lib/lp/registry/browser/tests/test_milestone.py
      * Added a test to verify the productseries has 0 bugtasks. There was
        1 before I made the code change to make the test pass :(

Implementation
--------------

    * lib/lp/registry/browser/__init__.py
      * Revised the problem code the delete the conjoined_master (the series
        bugtask).

To post a comment you must log in.
Revision history for this message
Guilherme Salgado (salgado) wrote :

Looks good to me

review: Approve (code)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'lib/lp/registry/browser/__init__.py'
2--- lib/lp/registry/browser/__init__.py 2010-08-09 22:30:04 +0000
3+++ lib/lp/registry/browser/__init__.py 2010-08-16 18:50:59 +0000
4@@ -218,7 +218,7 @@
5 self._unsubscribe_structure(milestone)
6 for bugtask in self._getBugtasks(milestone):
7 if bugtask.conjoined_master is not None:
8- Store.of(bugtask).remove(bugtask)
9+ Store.of(bugtask).remove(bugtask.conjoined_master)
10 else:
11 bugtask.milestone = None
12 for spec in self._getSpecifications(milestone):
13
14=== modified file 'lib/lp/registry/browser/tests/test_milestone.py'
15--- lib/lp/registry/browser/tests/test_milestone.py 2010-08-10 02:09:47 +0000
16+++ lib/lp/registry/browser/tests/test_milestone.py 2010-08-16 18:50:59 +0000
17@@ -102,6 +102,7 @@
18 view = create_initialized_view(milestone, '+delete', form=form)
19 self.assertEqual([], view.errors)
20 self.assertEqual(0, len(product.all_milestones))
21+ self.assertEqual(0, product.development_focus.all_bugtasks.count())
22
23
24 def test_suite():