~launchpad-pqm/launchpad/devel

« back to all changes in this revision

Viewing changes to lib/lp/soyuz/scripts/packagecopier.py

  • Committer: Curtis Hovey
  • Date: 2011-09-06 12:13:13 UTC
  • mfrom: (13883 devel)
  • mto: This revision was merged to the branch mainline in revision 13884.
  • Revision ID: curtis.hovey@canonical.com-20110906121313-2r9ep4ird8jw4nrl
Merged devel.

Show diffs side-by-side

added added

removed removed

Lines of Context:
628
628
            override = None
629
629
            if overrides:
630
630
                override = overrides[overrides_index]
 
631
            # Make a note of the destination source's version for use
 
632
            # in sending the email notification and closing bugs.
 
633
            existing = archive.getPublishedSources(
 
634
                name=source.sourcepackagerelease.name, exact_match=True,
 
635
                status=active_publishing_status,
 
636
                distroseries=series, pocket=pocket).first()
 
637
            if existing:
 
638
                old_version = existing.sourcepackagerelease.version
 
639
            else:
 
640
                old_version = None
631
641
            sub_copies = _do_direct_copy(
632
642
                source, archive, destination_series, pocket,
633
643
                include_binaries, override, close_bugs=close_bugs,
634
 
                create_dsd_job=create_dsd_job)
 
644
                create_dsd_job=create_dsd_job,
 
645
                close_bugs_since_version=old_version)
635
646
            if send_email:
636
647
                notify(
637
648
                    person, source.sourcepackagerelease, [], [], archive,
638
649
                    destination_series, pocket, changes=None,
639
650
                    action='accepted',
640
 
                    announce_from_person=announce_from_person)
 
651
                    announce_from_person=announce_from_person,
 
652
                    previous_version=old_version)
641
653
 
642
654
        overrides_index += 1
643
655
        copies.extend(sub_copies)
646
658
 
647
659
 
648
660
def _do_direct_copy(source, archive, series, pocket, include_binaries,
649
 
                    override=None, close_bugs=True, create_dsd_job=True):
 
661
                    override=None, close_bugs=True, create_dsd_job=True,
 
662
                    close_bugs_since_version=None):
650
663
    """Copy publishing records to another location.
651
664
 
652
665
    Copy each item of the given list of `SourcePackagePublishingHistory`
669
682
        copied publication should be closed.
670
683
    :param create_dsd_job: A boolean indicating whether or not a dsd job
671
684
         should be created for the new source publication.
 
685
    :param close_bugs_since_version: If close_bugs is True,
 
686
        then this parameter says which changelog entries to parse looking
 
687
        for bugs to close.  See `close_bugs_for_sourcepackagerelease`.
672
688
 
673
689
    :return: a list of `ISourcePackagePublishingHistory` and
674
690
        `BinaryPackagePublishingHistory` corresponding to the copied
700
716
        source_copy = source.copyTo(
701
717
            series, pocket, archive, override, create_dsd_job=create_dsd_job)
702
718
        if close_bugs:
703
 
            close_bugs_for_sourcepublication(source_copy)
 
719
            close_bugs_for_sourcepublication(
 
720
                source_copy, close_bugs_since_version)
704
721
        copies.append(source_copy)
705
722
    else:
706
723
        source_copy = source_in_destination.first()