Merge lp://staging/~deryck/launchpad/do-the-right-thing-dupe-move-78596 into lp://staging/launchpad

Proposed by Deryck Hodge
Status: Merged
Approved by: Deryck Hodge
Approved revision: no longer in the source branch.
Merged at revision: 11188
Proposed branch: lp://staging/~deryck/launchpad/do-the-right-thing-dupe-move-78596
Merge into: lp://staging/launchpad
Diff against target: 1018 lines (+214/-276)
31 files modified
lib/canonical/launchpad/fields/__init__.py (+0/-11)
lib/canonical/launchpad/mail/commands.py (+21/-11)
lib/lp/bugs/browser/bug.py (+27/-0)
lib/lp/bugs/browser/tests/bug-subscription-views.txt (+1/-1)
lib/lp/bugs/browser/tests/bug-views.txt (+5/-4)
lib/lp/bugs/browser/tests/special/bugs-fixed-elsewhere.txt (+1/-1)
lib/lp/bugs/browser/tests/special/bugtarget-recently-touched-bugs.txt (+1/-1)
lib/lp/bugs/configure.zcml (+0/-2)
lib/lp/bugs/doc/bug.txt (+13/-14)
lib/lp/bugs/doc/bugactivity.txt (+9/-7)
lib/lp/bugs/doc/bugnotification-sending.txt (+3/-2)
lib/lp/bugs/doc/bugsubscription.txt (+2/-2)
lib/lp/bugs/doc/bugtask-package-bugcounts.txt (+1/-1)
lib/lp/bugs/doc/bugtask-search.txt (+1/-1)
lib/lp/bugs/doc/bugzilla-import.txt (+3/-4)
lib/lp/bugs/doc/checkwatches.txt (+2/-2)
lib/lp/bugs/doc/malone-karma.txt (+1/-1)
lib/lp/bugs/interfaces/bug.py (+3/-4)
lib/lp/bugs/model/bug.py (+3/-5)
lib/lp/bugs/scripts/bugimport.py (+2/-2)
lib/lp/bugs/scripts/bugzilla.py (+1/-1)
lib/lp/bugs/stories/duplicate-bug-handling/10-mark-bug-as-duplicate.txt (+0/-48)
lib/lp/bugs/stories/duplicate-bug-handling/20-show-bug-is-duplicate.txt (+0/-41)
lib/lp/bugs/stories/duplicate-bug-handling/xx-mark-duplicate-validation.txt (+0/-76)
lib/lp/bugs/tests/bug.py (+2/-1)
lib/lp/bugs/tests/bugs-emailinterface.txt (+1/-27)
lib/lp/bugs/tests/bugtarget-bugcount.txt (+1/-1)
lib/lp/bugs/tests/test_bugchanges.py (+6/-3)
lib/lp/bugs/tests/test_bugnotification.py (+1/-1)
lib/lp/bugs/tests/test_duplicate_handling.py (+102/-0)
lib/lp/registry/browser/tests/person-views.txt (+1/-1)
To merge this branch: bzr merge lp://staging/~deryck/launchpad/do-the-right-thing-dupe-move-78596
Reviewer Review Type Date Requested Status
Abel Deuring (community) code Approve
Review via email: mp+27144@code.staging.launchpad.net

Commit message

Converge on using markAsDuplicate rather than setting duplicateof directly. Also, enable automatic moving of duplicates when marking a bug a duplicate that itself has duplicates.

Description of the change

This branch fixes the bugs team's handling of setting duplicates. Before
this work, there were two ways to set a duplicate of a bug -- setting
duplicateof directly or using markAsDuplicate. Setting duplicateof
directly was commonly used; however, this bypassed validation provided in
markAsDuplicate and really should not have been done. This branch fixes
that by converting to use markAsDuplicate consistently and changing the
interface and zcml to make duplicateof readonly. I also removed the
previous field readonly_duplicate, which seemed to be a hackish way to
achieve this for the API without doing all the work here.

This fixes bug 589660.

While I was here and because I was changing how validation was tested, I
decided to do a three line fix to enable moving of duplicates. Until now,
if you wanted to mark a bug as a duplicate and that bug had duplicates
itself, you had to manually move all the duplicates. This changes that
behavior so that the duplicates are moved across automatically.

This fixes bug 78596.

I don't want to land this branch until I add a confirmation dialog in
JavaScript for marking duplicate bug that also has duplicates. This was
suggested during a bugs team standup, since it would be a lot of work to
undo the damage if people aren't aware of the coming change. This branch
has gotten long with all the tests changed, so I want to review it first
before doing the small UI work left.

I had pre-implementation discussions with Björn and mid-implementation
discussions with Abel.

Appologies for the length of the diff, but most of this is removing dead
tests and one-line changes to lots of files to move from using duplicateof
to markAsDuplicate.

Files changed:

 lib/lp/bugs/configure.zcml
 lib/lp/bugs/interfaces/bug.py
 lib/lp/bugs/model/bug.py
    Removed readonly_duplicate and made duplicateof
    a properly readonly field.

 lib/lp/bugs/browser/bug.py
    Update form to use markAsDuplicate and not
    set duplicateof directly.

 lib/lp/bugs/browser/tests/bug-subscription-views.txt
 lib/lp/bugs/browser/tests/bug-views.txt
 lib/lp/bugs/browser/tests/special/bugs-fixed-elsewhere.txt
 lib/lp/bugs/browser/tests/special/bugtarget-recently-touched-bugs.txt
 lib/lp/bugs/doc/bug.txt
 lib/lp/bugs/doc/bugactivity.txt
 lib/lp/bugs/doc/bugnotification-sending.txt
 lib/lp/bugs/doc/bugsubscription.txt
 lib/lp/bugs/doc/bugtask-package-bugcounts.txt
 lib/lp/bugs/doc/bugtask-search.txt
 lib/lp/bugs/doc/bugzilla-import.txt
 lib/lp/bugs/doc/checkwatches.txt
 lib/lp/bugs/doc/malone-karma.txt
 lib/lp/bugs/scripts/bugimport.py
 lib/lp/bugs/scripts/bugzilla.py
 lib/lp/bugs/scripts/tests/test_bugheat.py
 lib/lp/bugs/tests/bug.py
 lib/lp/bugs/tests/bugtarget-bugcount.txt
 lib/lp/bugs/tests/test_bugchanges.py
 lib/lp/bugs/tests/test_bugnotification.py
    All tests and call sites updated to use markAsDuplicate,
    rather than set duplicateof directly

    In some cases, I changed the data used in the test
    because tests were wrong. Using duplicateof
    bypassed validation, and tests were settings bugs
    to duplicate of bugs that were already themselves
    duplicates.

 lib/lp/bugs/stories/duplicate-bug-handling/10-mark-bug-as-duplicate.txt
 lib/lp/bugs/stories/duplicate-bug-handling/20-show-bug-is-duplicate.txt
 lib/lp/bugs/stories/duplicate-bug-handling/xx-mark-duplicate-validation.txt
    Removed page tests that are now covered by other
    tests, either the new dupe handling unit test or
    Windmill test.

 lib/lp/bugs/tests/test_duplicate_handling.py
    Added unit test to verify duplicateof is read-only,
    that validation works, and that duplicates are
    moved properly.

 lib/canonical/launchpad/fields/__init__.py
    Remove validation preventing moving duplicates.

To post a comment you must log in.
Revision history for this message
Deryck Hodge (deryck) wrote :

I've filed Bug #591705 about the remaining UI work before this can land.

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

Overall, the changes look good. I only have one concern (sorry for coming up so late with it...): We have the new behaviour that marking bug A as a duplicate of bug B changes all old duplicates of bug A into duplicates of bug B. This is not recorded in the activity log of the duplicates, leading to the odd situation that you might have bug C marked as a duplcate of bug B, while the activity log says that it is a duplicate of bug A...

Also, having activity log entries for the changes of the duplicate_of value gives us the opportunity to revert the duplicate_of value of bug C, when bug A is "unmarked" as a duplicate of bug B.

But that's something for another branch (assuming that we think it is worth the effort), so I'm marking this one as approved. thanks for the tedious work of cleaning up the duplicate_of handling!

review: Approve (code)
Revision history for this message
Francis J. Lacoste (flacoste) wrote :

What about the API aspect of this?

Shouldn't markAsDuplicate becomes a mutator for the field?

That's also arguably a backward incompatible change, so should be tagged
accordingly.

Talk to Leonard for help on how to do this.

--
Francis J. Lacoste
<email address hidden>

Revision history for this message
Deryck Hodge (deryck) wrote :

On Wed, Jun 9, 2010 at 9:55 AM, Francis J. Lacoste
<email address hidden> wrote:
> What about the API aspect of this?
>
> Shouldn't markAsDuplicate becomes a mutator for the field?
>

markAsDuplicate has always been the mutator for duplicateof. This
change affects only the internal use of duplicateof vs.
markAsDuplicate. The API should be unaffected.

Cheers,
deryck

Revision history for this message
Deryck Hodge (deryck) wrote :

Abel, I agree we should do the activity log handling correctly. I'll fix that in my UI branch for this work.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
The diff is not available at this time. You can reload the page or download it.