~launchpad-pqm/launchpad/devel

« back to all changes in this revision

Viewing changes to lib/lp/registry/model/distroseriesdifference.py

  • Committer: Jeroen Vermeulen
  • Date: 2011-07-01 15:53:38 UTC
  • mto: This revision was merged to the branch mainline in revision 13386.
  • Revision ID: jeroen.vermeulen@canonical.com-20110701155338-z58oi84w8m8rutzd
Filter DistroSeriesDifferences query by Packageset.

Show diffs side-by-side

added added

removed removed

Lines of Context:
25
25
    And,
26
26
    Column,
27
27
    Desc,
 
28
    Select,
28
29
    Table,
29
30
    )
30
31
from storm.locals import (
65
66
    )
66
67
from lp.registry.interfaces.distroseriesparent import IDistroSeriesParentSet
67
68
from lp.registry.interfaces.person import IPersonSet
68
 
from lp.registry.model.distroseries import DistroSeries
69
69
from lp.registry.model.distroseriesdifferencecomment import (
70
70
    DistroSeriesDifferenceComment,
71
71
    )
203
203
    return DecoratedResultSet(comments, itemgetter(0))
204
204
 
205
205
 
206
 
def packagesets(dsds, in_parent):
 
206
def get_packagesets(dsds, in_parent):
207
207
    """Return the packagesets for the given dsds inside the parent or
208
208
    the derived `DistroSeries`.
209
209
 
336
336
        source_package_name_filter=None,
337
337
        status=None,
338
338
        child_version_higher=False,
339
 
        parent_series=None):
 
339
        parent_series=None,
 
340
        packagesets=None):
340
341
        """See `IDistroSeriesDifferenceSource`."""
341
342
        if difference_type is None:
342
343
            difference_type = DistroSeriesDifferenceType.DIFFERENT_VERSIONS
368
369
                DistroSeriesDifference.source_version >
369
370
                    DistroSeriesDifference.parent_source_version])
370
371
 
 
372
        if packagesets is not None:
 
373
            set_ids = [packageset.id for packageset in packagesets]
 
374
            conditions.extend([
 
375
                DistroSeriesDifference.source_package_name_id.is_in(
 
376
                    Select(
 
377
                        PackagesetSources.sourcepackagename_id,
 
378
                        PackagesetSources.packageset_id.is_in(set_ids)))])
 
379
 
371
380
        differences = IStore(DistroSeriesDifference).find(
372
381
            DistroSeriesDifference,
373
382
            And(*conditions)).order_by(SourcePackageName.name)
410
419
                ("sourcepackagereleaseID",))
411
420
 
412
421
            # Get packagesets and parent_packagesets for each DSD.
413
 
            dsd_packagesets = packagesets(dsds, in_parent=False)
414
 
            dsd_parent_packagesets = packagesets(dsds, in_parent=True)
 
422
            dsd_packagesets = get_packagesets(dsds, in_parent=False)
 
423
            dsd_parent_packagesets = get_packagesets(dsds, in_parent=True)
415
424
 
416
425
            # Cache latest messages contents (MessageChunk).
417
426
            messages = bulk.load_related(