421
422
return BugNotificationLevel.METADATA
423
424
def getBugActivity(self):
425
import pdb; pdb.set_trace(); # DO NOT COMMIT
426
if self.old_value is not None and self.new_value is not None:
428
'whatchanged': CHANGED_DUPLICATE_MARKER,
429
'oldvalue': str(self.old_value.id),
430
'newvalue': str(self.new_value.id),
432
elif self.old_value is None:
434
'whatchanged': MARKED_AS_DUPLICATE,
435
'newvalue': str(self.new_value.id),
437
elif self.new_value is None:
439
'whatchanged': REMOVED_DUPLICATE_MARKER,
440
'oldvalue': str(self.old_value.id),
443
raise AssertionError(
444
"There is no change: both the old bug and new bug are None.")
446
def getBugNotification(self):
447
if self.old_value is not None and self.new_value is not None:
448
if self.old_value.private:
450
"** This bug is no longer a duplicate of private bug "
451
"%d" % self.old_value.id)
454
"** This bug is no longer a duplicate of bug %d\n"
455
" %s" % (self.old_value.id, self.old_value.title))
456
if self.new_value.private:
458
"** This bug has been marked a duplicate of private bug "
459
"%d" % self.new_value.id)
462
"** This bug has been marked a duplicate of bug %d\n"
463
" %s" % (self.new_value.id, self.new_value.title))
465
text = "\n".join((old_value_text, new_value_text))
467
elif self.old_value is None:
468
if self.new_value.private:
470
"** This bug has been marked a duplicate of private bug "
471
"%d" % self.new_value.id)
474
"** This bug has been marked a duplicate of bug %d\n"
475
" %s" % (self.new_value.id, self.new_value.title))
477
elif self.new_value is None:
478
if self.old_value.private:
480
"** This bug is no longer a duplicate of private bug "
481
"%d" % self.old_value.id)
484
"** This bug is no longer a duplicate of bug %d\n"
485
" %s" % (self.old_value.id, self.old_value.title))
488
raise AssertionError(
489
"There is no change: both the old bug and new bug are None.")
491
return {'text': text}
494
class DeferredBugDuplicateChange(AttributeChange):
495
"""Describes a change to a bug's duplicate marker.
497
This change is merely queued up without a recipients list given. The
498
post-processing job is responsible for computing the recipients list and
499
then sending the notifications.
501
The deferral may be fragile if multiple changes are made to the bug's
502
duplicate status before the post-processor runs, so checks must be
503
performed to ensure the state is still as expected.
505
def __init__(self, when, person, what_changed,
506
old_value, new_value):
507
super(DeferredBugDuplicateChange, self).__init__(
508
when, person, what_changed, old_value, new_value)
510
def getBugActivity(self):
511
import pdb; pdb.set_trace(); # DO NOT COMMIT
424
512
if self.old_value is not None and self.new_value is not None:
426
514
'whatchanged': CHANGED_DUPLICATE_MARKER,