<s> from testrunner import testhelp <EOL> import re <EOL> import bz2 <EOL> import itertools <EOL> from conary_test import rephelp <EOL> from conary import conaryclient , errors <EOL> from conary . deps import deps <EOL> from conary import conarycfg <EOL> from conary import versions <EOL> from conary . cmds . queryrep import VERSION_FILTER_ALL , VERSION_FILTER_LATEST <EOL> from conary . cmds . queryrep import VERSION_FILTER_LEAVES <EOL> from conary . cmds . queryrep import FLAVOR_FILTER_ALL , FLAVOR_FILTER_AVAIL <EOL> from conary . cmds . queryrep import FLAVOR_FILTER_BEST , FLAVOR_FILTER_EXACT <EOL> from conary . cmds import queryrep <EOL> from conary . conaryclient import cmdline <EOL> from conary . repository import trovesource <EOL> from conary . repository . trovesource import TROVE_QUERY_NORMAL <EOL> from conary . repository . trovesource import TROVE_QUERY_PRESENT <EOL> from conary . repository . trovesource import TROVE_QUERY_ALL <EOL> from conary . versions import VersionFromString as VFS <EOL> class RepQueryTest ( rephelp . RepositoryHelper ) : <EOL> def _rdiff ( self , troveSpec , ** kwargs ) : <EOL> client = conaryclient . ConaryClient ( self . cfg ) <EOL> return self . captureOutput ( queryrep . rdiffCommand , self . cfg , <EOL> client , client . getDatabase ( ) , troveSpec , <EOL> ** kwargs ) <EOL> def testBadQuery ( self ) : <EOL> try : <EOL> queryrep . getTrovesToDisplay ( None , [ '<STR_LIT>' ] , [ ] , [ ] , <EOL> VERSION_FILTER_ALL , FLAVOR_FILTER_ALL , <EOL> self . cfg . installLabelPath , self . cfg . flavor , <EOL> None ) <EOL> except errors . ParseError , msg : <EOL> assert ( str ( msg ) == '<STR_LIT>' ) <EOL> else : <EOL> assert ( <NUM_LIT:0> ) <EOL> def _checkTupVers ( self , tups , vers ) : <EOL> for tup , item in itertools . izip ( tups , vers ) : <EOL> if isinstance ( item , ( list , tuple ) ) : <EOL> verStr , flStr = item <EOL> else : <EOL> verStr = item <EOL> flStr = None <EOL> if '<STR_LIT:->' in verStr : <EOL> assert ( str ( tup [ <NUM_LIT:1> ] . trailingRevision ( ) ) == verStr ) <EOL> else : <EOL> assert ( str ( tup [ <NUM_LIT:1> ] . trailingRevision ( ) . version ) == verStr ) <EOL> if flStr : <EOL> assert ( str ( tup [ <NUM_LIT:2> ] ) == flStr ) <EOL> def testGetTrovesVersions ( self ) : <EOL> self . addComponent ( '<STR_LIT>' , '<STR_LIT:1.0>' , '<STR_LIT>' ) <EOL> self . addComponent ( '<STR_LIT>' , '<STR_LIT:1.0>' , '<STR_LIT>' ) <EOL> self . addComponent ( '<STR_LIT>' , '<STR_LIT:1.0>' , '<STR_LIT>' ) <EOL> self . addComponent ( '<STR_LIT>' , '<STR_LIT:1.0>' , '<STR_LIT>' ) <EOL> self . addComponent ( '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ) <EOL> self . addComponent ( '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ) <EOL> self . addComponent ( '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ) <EOL> repos = self . openRepository ( ) <EOL> targetFlavor = [ deps . parseFlavor ( '<STR_LIT>' ) ] <EOL> def _check ( troveSpecs , versionFilter , flavorFilter , expected ) : <EOL> tups = queryrep . getTrovesToDisplay ( repos , troveSpecs , [ ] , [ ] , <EOL> versionFilter , flavorFilter , <EOL> self . cfg . installLabelPath , <EOL> targetFlavor , <EOL> None ) <EOL> self . _checkTupVers ( tups , expected ) <EOL> _check ( [ '<STR_LIT>' ] , VERSION_FILTER_ALL , FLAVOR_FILTER_BEST , <EOL> [ '<STR_LIT:1.0>' , '<STR_LIT>' , '<STR_LIT>' ] ) <EOL> _check ( [ '<STR_LIT>' ] , VERSION_FILTER_ALL , FLAVOR_FILTER_BEST , <EOL> [ '<STR_LIT>' , '<STR_LIT>' ] ) <EOL> _check ( [ '<STR_LIT>' ] , VERSION_FILTER_ALL , FLAVOR_FILTER_BEST , <EOL> [ '<STR_LIT:1.0>' , '<STR_LIT>' ] ) <EOL> _check ( [ '<STR_LIT>' ] , VERSION_FILTER_ALL , FLAVOR_FILTER_AVAIL , <EOL> [ '<STR_LIT:1.0>' , '<STR_LIT:1.0>' , '<STR_LIT>' ] ) <EOL> _check ( [ '<STR_LIT>' ] , VERSION_FILTER_ALL , FLAVOR_FILTER_ALL , <EOL> [ '<STR_LIT:1.0>' , '<STR_LIT:1.0>' , '<STR_LIT:1.0>' , '<STR_LIT>' ] ) <EOL> _check ( [ '<STR_LIT>' ] , VERSION_FILTER_ALL , FLAVOR_FILTER_ALL , <EOL> [ '<STR_LIT:1.0>' , '<STR_LIT:1.0>' , '<STR_LIT:1.0>' , '<STR_LIT:1.0>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ] ) <EOL> _check ( [ ] , VERSION_FILTER_ALL , FLAVOR_FILTER_BEST , <EOL> [ '<STR_LIT:1.0>' , '<STR_LIT>' , '<STR_LIT>' ] ) <EOL> _check ( [ ] , VERSION_FILTER_ALL , FLAVOR_FILTER_AVAIL , <EOL> [ '<STR_LIT:1.0>' , '<STR_LIT:1.0>' , '<STR_LIT:1.0>' , '<STR_LIT>' , '<STR_LIT>' ] ) <EOL> _check ( [ ] , VERSION_FILTER_ALL , FLAVOR_FILTER_ALL , <EOL> [ '<STR_LIT:1.0>' , '<STR_LIT:1.0>' , '<STR_LIT:1.0>' , '<STR_LIT:1.0>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ] ) <EOL> _check ( [ '<STR_LIT>' ] , VERSION_FILTER_LEAVES , FLAVOR_FILTER_BEST , <EOL> [ '<STR_LIT>' ] ) <EOL> _check ( [ '<STR_LIT>' ] , VERSION_FILTER_LEAVES , FLAVOR_FILTER_BEST , <EOL> [ '<STR_LIT>' ] ) <EOL> _check ( [ '<STR_LIT>' ] , VERSION_FILTER_LEAVES , <EOL> FLAVOR_FILTER_BEST , [ '<STR_LIT>' ] ) <EOL> _check ( [ '<STR_LIT>' ] , VERSION_FILTER_LEAVES , <EOL> FLAVOR_FILTER_AVAIL , [ '<STR_LIT:1.0>' , '<STR_LIT:1.0>' , '<STR_LIT>' ] ) <EOL> _check ( [ '<STR_LIT>' ] , VERSION_FILTER_LEAVES , <EOL> FLAVOR_FILTER_ALL , [ '<STR_LIT:1.0>' , '<STR_LIT:1.0>' , '<STR_LIT:1.0>' , '<STR_LIT>' ] ) <EOL> _check ( [ '<STR_LIT>' ] , VERSION_FILTER_LEAVES , FLAVOR_FILTER_ALL , <EOL> [ '<STR_LIT:1.0>' , '<STR_LIT:1.0>' , '<STR_LIT:1.0>' , '<STR_LIT>' , '<STR_LIT>' ] ) <EOL> _check ( [ ] , VERSION_FILTER_LEAVES , FLAVOR_FILTER_BEST , <EOL> [ '<STR_LIT:1.0>' , '<STR_LIT>' ] ) <EOL> _check ( [ ] , VERSION_FILTER_LEAVES , FLAVOR_FILTER_AVAIL , <EOL> [ '<STR_LIT:1.0>' , '<STR_LIT:1.0>' , '<STR_LIT>' ] ) <EOL> _check ( [ ] , VERSION_FILTER_LEAVES , FLAVOR_FILTER_ALL , <EOL> [ '<STR_LIT:1.0>' , '<STR_LIT:1.0>' , '<STR_LIT:1.0>' , '<STR_LIT>' , '<STR_LIT>' ] ) <EOL> _check ( [ '<STR_LIT>' ] , VERSION_FILTER_LATEST , FLAVOR_FILTER_BEST , <EOL> [ '<STR_LIT>' ] ) <EOL> _check ( [ '<STR_LIT>' ] , VERSION_FILTER_LATEST , FLAVOR_FILTER_BEST , <EOL> [ '<STR_LIT>' ] ) <EOL> _check ( [ '<STR_LIT>' ] , VERSION_FILTER_LATEST , <EOL> FLAVOR_FILTER_BEST , [ '<STR_LIT>' ] ) <EOL> _check ( [ '<STR_LIT>' ] , VERSION_FILTER_LATEST , <EOL> FLAVOR_FILTER_AVAIL , [ '<STR_LIT>' ] ) <EOL> _check ( [ '<STR_LIT>' ] , VERSION_FILTER_LATEST , <EOL> FLAVOR_FILTER_ALL , [ '<STR_LIT>' ] ) <EOL> _check ( [ '<STR_LIT>' ] , VERSION_FILTER_LATEST , FLAVOR_FILTER_ALL , <EOL> [ '<STR_LIT>' ] ) <EOL> self . addComponent ( '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ) <EOL> self . addComponent ( '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ) <EOL> self . addComponent ( '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ) <EOL> self . addComponent ( '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ) <EOL> _check ( [ '<STR_LIT>' ] , VERSION_FILTER_LATEST , FLAVOR_FILTER_BEST , <EOL> [ '<STR_LIT>' ] ) <EOL> _check ( [ '<STR_LIT>' ] , VERSION_FILTER_LATEST , <EOL> FLAVOR_FILTER_BEST , [ '<STR_LIT>' ] ) <EOL> _check ( [ '<STR_LIT>' ] , VERSION_FILTER_LATEST , <EOL> FLAVOR_FILTER_AVAIL , [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ] ) <EOL> _check ( [ '<STR_LIT>' ] , VERSION_FILTER_LATEST , <EOL> FLAVOR_FILTER_ALL , [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ] ) <EOL> _check ( [ ] , VERSION_FILTER_LATEST , FLAVOR_FILTER_BEST , <EOL> [ '<STR_LIT>' ] ) <EOL> _check ( [ ] , VERSION_FILTER_LATEST , <EOL> FLAVOR_FILTER_AVAIL , [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ] ) <EOL> _check ( [ ] , VERSION_FILTER_LATEST , <EOL> FLAVOR_FILTER_ALL , [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ] ) <EOL> def testQueryByTroveType ( self ) : <EOL> repos = self . openRepository ( ) <EOL> def _check ( troveSpecs , versionFilter , flavorFilter , expected , all = False , <EOL> present = False ) : <EOL> if all : <EOL> troveTypes = TROVE_QUERY_ALL <EOL> elif present : <EOL> troveTypes = TROVE_QUERY_PRESENT <EOL> else : <EOL> troveTypes = TROVE_QUERY_NORMAL <EOL> tups = queryrep . getTrovesToDisplay ( repos , troveSpecs , [ ] , [ ] , <EOL> versionFilter , flavorFilter , <EOL> self . cfg . installLabelPath , <EOL> self . cfg . flavor , <EOL> None , <EOL> troveTypes = troveTypes ) <EOL> self . _checkTupVers ( tups , expected ) <EOL> self . addComponent ( '<STR_LIT>' , '<STR_LIT:1.0>' ) <EOL> self . addComponent ( '<STR_LIT>' , '<STR_LIT>' , redirect = [ '<STR_LIT>' ] ) <EOL> self . addComponent ( '<STR_LIT>' , '<STR_LIT:1.0>' ) <EOL> self . addComponent ( '<STR_LIT>' , '<STR_LIT>' , redirect = [ '<STR_LIT>' ] ) <EOL> self . addComponent ( '<STR_LIT>' , '<STR_LIT>' ) <EOL> self . markRemoved ( '<STR_LIT>' ) <EOL> _check ( [ ] , VERSION_FILTER_ALL , FLAVOR_FILTER_ALL , <EOL> [ '<STR_LIT:1.0>' , '<STR_LIT:1.0>' ] ) <EOL> _check ( [ ] , VERSION_FILTER_ALL , FLAVOR_FILTER_ALL , <EOL> [ '<STR_LIT:1.0>' , '<STR_LIT>' , '<STR_LIT:1.0>' , '<STR_LIT>' ] , present = True ) <EOL> _check ( [ ] , VERSION_FILTER_ALL , FLAVOR_FILTER_ALL , <EOL> [ '<STR_LIT:1.0>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT:1.0>' , '<STR_LIT>' ] , all = True ) <EOL> _check ( [ ] , VERSION_FILTER_LEAVES , FLAVOR_FILTER_ALL , [ ] ) <EOL> _check ( [ ] , VERSION_FILTER_LEAVES , FLAVOR_FILTER_ALL , <EOL> [ '<STR_LIT>' , '<STR_LIT>' ] , present = True ) <EOL> _check ( [ ] , VERSION_FILTER_LEAVES , FLAVOR_FILTER_ALL , <EOL> [ '<STR_LIT>' , '<STR_LIT>' ] , all = True ) <EOL> _check ( [ ] , VERSION_FILTER_LATEST , FLAVOR_FILTER_ALL , [ ] ) <EOL> _check ( [ ] , VERSION_FILTER_LATEST , FLAVOR_FILTER_ALL , [ '<STR_LIT>' , '<STR_LIT>' ] , present = True ) <EOL> _check ( [ ] , VERSION_FILTER_LATEST , FLAVOR_FILTER_ALL , [ '<STR_LIT>' , '<STR_LIT>' ] , all = True ) <EOL> def testGetTrovesLeavesMultiRepos ( self ) : <EOL> v1 = self . addComponent ( '<STR_LIT>' , '<STR_LIT:1.0>' ) . getVersion ( ) <EOL> v2 = self . addComponent ( '<STR_LIT>' , '<STR_LIT>' ) . getVersion ( ) <EOL> installLabelPath = conarycfg . CfgLabelList ( <EOL> [ versions . Label ( '<STR_LIT>' ) , <EOL> self . cfg . buildLabel ] ) <EOL> repos = self . openRepository ( ) <EOL> tups = queryrep . getTrovesToDisplay ( repos , [ ] , [ ] , [ ] , <EOL> VERSION_FILTER_LEAVES , <EOL> FLAVOR_FILTER_ALL , <EOL> installLabelPath , <EOL> self . cfg . flavor , affinityDb = None ) <EOL> assert ( set ( [ x [ <NUM_LIT:1> ] for x in tups ] ) == set ( ( v1 , v2 ) ) ) <EOL> tups = queryrep . getTrovesToDisplay ( repos , [ '<STR_LIT>' ] , [ ] , [ ] , <EOL> VERSION_FILTER_LEAVES , <EOL> FLAVOR_FILTER_ALL , <EOL> installLabelPath , <EOL> self . cfg . flavor , affinityDb = None ) <EOL> assert ( set ( [ x [ <NUM_LIT:1> ] for x in tups ] ) == set ( ( v1 , v2 ) ) ) <EOL> tups = queryrep . getTrovesToDisplay ( repos , [ '<STR_LIT>' ] , [ ] , [ ] , <EOL> VERSION_FILTER_LATEST , <EOL> FLAVOR_FILTER_ALL , <EOL> installLabelPath , <EOL> self . cfg . flavor , affinityDb = None ) <EOL> assert ( set ( [ x [ <NUM_LIT:1> ] for x in tups ] ) == set ( ( v1 , v2 ) ) ) <EOL> tups = queryrep . getTrovesToDisplay ( repos , [ ] , [ ] , [ ] , <EOL> VERSION_FILTER_LATEST , <EOL> FLAVOR_FILTER_ALL , <EOL> installLabelPath , <EOL> self . cfg . flavor , affinityDb = None ) <EOL> assert ( set ( [ x [ <NUM_LIT:1> ] for x in tups ] ) == set ( ( v1 , v2 ) ) ) <EOL> def testGetTrovesLatestByLabel ( self ) : <EOL> trv1 = self . addComponent ( '<STR_LIT>' , '<STR_LIT>' ) <EOL> trv2 = self . addComponent ( '<STR_LIT>' , '<STR_LIT>' ) <EOL> trv3 = self . addComponent ( '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ) <EOL> repos = self . openRepository ( ) <EOL> tups = queryrep . getTrovesToDisplay ( repos , [ ] , [ ] , [ ] , <EOL> VERSION_FILTER_LATEST , <EOL> FLAVOR_FILTER_BEST , <EOL> self . cfg . installLabelPath , <EOL> self . cfg . flavor , affinityDb = None ) <EOL> assert ( len ( tups ) == <NUM_LIT:1> ) <EOL> assert ( tups [ <NUM_LIT:0> ] == trv3 . getNameVersionFlavor ( ) ) <EOL> tups = queryrep . getTrovesToDisplay ( repos , [ ] , [ ] , [ ] , <EOL> VERSION_FILTER_LEAVES , <EOL> FLAVOR_FILTER_BEST , <EOL> self . cfg . installLabelPath , <EOL> self . cfg . flavor , affinityDb = None ) <EOL> assert ( len ( tups ) == <NUM_LIT:2> ) <EOL> assert ( set ( tups ) == set ( [ trv3 . getNameVersionFlavor ( ) , <EOL> trv2 . getNameVersionFlavor ( ) ] ) ) <EOL> def testLatestIsOfWrongFlavor ( self ) : <EOL> v1 = self . addComponent ( '<STR_LIT>' , '<STR_LIT:1.0>' , '<STR_LIT>' ) . getVersion ( ) <EOL> v2 = self . addComponent ( '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ) . getVersion ( ) <EOL> targetFlavor = [ deps . parseFlavor ( '<STR_LIT>' ) ] <EOL> repos = self . openRepository ( ) <EOL> tups = queryrep . getTrovesToDisplay ( repos , [ ] , [ ] , [ ] , <EOL> VERSION_FILTER_LATEST , <EOL> FLAVOR_FILTER_BEST , <EOL> self . cfg . installLabelPath , <EOL> targetFlavor , affinityDb = None ) <EOL> assert ( set ( [ x [ <NUM_LIT:1> ] for x in tups ] ) == set ( ( v1 , ) ) ) <EOL> tups = queryrep . getTrovesToDisplay ( repos , [ ] , [ ] , [ ] , <EOL> VERSION_FILTER_LATEST , <EOL> FLAVOR_FILTER_AVAIL , <EOL> self . cfg . installLabelPath , <EOL> targetFlavor , affinityDb = None ) <EOL> assert ( set ( [ x [ <NUM_LIT:1> ] for x in tups ] ) == set ( ( v1 , ) ) ) <EOL> def testExactFlavor ( self ) : <EOL> self . addComponent ( '<STR_LIT>' ) <EOL> repos = self . openRepository ( ) <EOL> def _get ( troveSpec ) : <EOL> try : <EOL> return queryrep . getTrovesToDisplay ( repos , [ troveSpec ] , [ ] , [ ] , <EOL> VERSION_FILTER_LATEST , <EOL> FLAVOR_FILTER_EXACT , <EOL> self . cfg . installLabelPath , <EOL> self . cfg . flavor , None ) <EOL> except errors . TroveNotFound : <EOL> return [ ] <EOL> assert ( not _get ( '<STR_LIT>' ) ) <EOL> assert ( not _get ( '<STR_LIT>' ) ) <EOL> assert ( _get ( '<STR_LIT>' ) ) <EOL> def testTroveNames ( self ) : <EOL> for x in "<STR_LIT>" : <EOL> for ver in "<STR_LIT>" : <EOL> self . addComponent ( "<STR_LIT>" % x , ver ) <EOL> self . addComponent ( "<STR_LIT>" % x , ver ) <EOL> self . addCollection ( "<STR_LIT>" % x , ver , [ "<STR_LIT>" , "<STR_LIT>" ] ) <EOL> repos = self . openRepository ( ) <EOL> ret = repos . troveNamesOnServer ( "<STR_LIT:localhost>" ) <EOL> self . assertEqual ( set ( ret ) , <EOL> set ( [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , <EOL> '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ] ) ) <EOL> self . markRemoved ( "<STR_LIT>" ) <EOL> ret = repos . troveNamesOnServer ( "<STR_LIT:localhost>" ) <EOL> self . assertEqual ( set ( ret ) , <EOL> set ( [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , <EOL> '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ] ) ) <EOL> self . markRemoved ( "<STR_LIT>" ) <EOL> ret = repos . troveNamesOnServer ( "<STR_LIT:localhost>" ) <EOL> self . assertEqual ( set ( ret ) , set ( [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ] ) ) <EOL> self . addCollection ( "<STR_LIT>" , [ ( "<STR_LIT>" , "<STR_LIT:2>" ) , ( "<STR_LIT>" , "<STR_LIT:0>" ) ] ) <EOL> ret = repos . troveNamesOnServer ( "<STR_LIT:localhost>" ) <EOL> self . assertEqual ( set ( ret ) , set ( [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , "<STR_LIT>" ] ) ) <EOL> self . markRemoved ( "<STR_LIT>" ) <EOL> ret = repos . troveNamesOnServer ( "<STR_LIT:localhost>" ) <EOL> self . assertEqual ( set ( ret ) , set ( [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , "<STR_LIT>" ] ) ) <EOL> self . markRemoved ( "<STR_LIT>" ) <EOL> ret = repos . troveNamesOnServer ( "<STR_LIT:localhost>" ) <EOL> self . assertEqual ( set ( ret ) , set ( [ "<STR_LIT>" ] ) ) <EOL> self . markRemoved ( "<STR_LIT>" ) <EOL> ret = repos . troveNamesOnServer ( "<STR_LIT:localhost>" ) <EOL> self . assertEqual ( set ( ret ) , set ( ) ) <EOL> self . addCollection ( "<STR_LIT>" , [ "<STR_LIT>" , "<STR_LIT>" ] ) <EOL> self . addComponent ( "<STR_LIT>" , "<STR_LIT>" ) <EOL> ret = repos . troveNamesOnServer ( "<STR_LIT:localhost>" ) <EOL> self . assertEqual ( set ( ret ) , set ( [ "<STR_LIT>" , "<STR_LIT>" ] ) ) <EOL> self . markRemoved ( "<STR_LIT>" ) <EOL> ret = repos . troveNamesOnServer ( "<STR_LIT:localhost>" ) <EOL> self . assertEqual ( set ( ret ) , set ( [ "<STR_LIT>" ] ) ) <EOL> def testAffinity ( self ) : <EOL> self . addComponent ( '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , <EOL> [ '<STR_LIT>' ] ) <EOL> self . addComponent ( '<STR_LIT>' , '<STR_LIT>' , <EOL> '<STR_LIT>' , [ '<STR_LIT>' ] ) <EOL> self . addComponent ( '<STR_LIT>' , '<STR_LIT>' , <EOL> '<STR_LIT>' , [ '<STR_LIT>' ] ) <EOL> self . addComponent ( '<STR_LIT>' , '<STR_LIT>' , <EOL> '<STR_LIT>' , [ '<STR_LIT>' ] ) <EOL> self . addComponent ( '<STR_LIT>' , '<STR_LIT>' , <EOL> '<STR_LIT>' , [ '<STR_LIT>' ] ) <EOL> self . addComponent ( '<STR_LIT>' , <EOL> '<STR_LIT>' , '<STR_LIT>' ) <EOL> self . updatePkg ( '<STR_LIT>' ) <EOL> repos = self . openRepository ( ) <EOL> def _get ( affinityDb , versionFilter , flavorFilter , troveSpec ) : <EOL> return queryrep . getTrovesToDisplay ( repos , troveSpec , [ ] , [ ] , <EOL> versionFilter , <EOL> flavorFilter , <EOL> self . cfg . installLabelPath , <EOL> self . cfg . flavor , affinityDb ) <EOL> db = self . openDatabase ( ) <EOL> troveTups = _get ( db , VERSION_FILTER_LATEST , <EOL> FLAVOR_FILTER_BEST , [ '<STR_LIT>' ] ) <EOL> assert ( len ( troveTups ) == <NUM_LIT:1> ) <EOL> assert ( troveTups [ <NUM_LIT:0> ] [ <NUM_LIT:1> ] . branch ( ) == VFS ( '<STR_LIT>' ) ) <EOL> assert ( str ( troveTups [ <NUM_LIT:0> ] [ <NUM_LIT:2> ] ) == '<STR_LIT>' ) <EOL> troveTups = _get ( db , VERSION_FILTER_LATEST , <EOL> FLAVOR_FILTER_AVAIL , [ '<STR_LIT>' ] ) <EOL> assert ( len ( troveTups ) == <NUM_LIT:2> ) <EOL> flavors = set ( str ( x [ <NUM_LIT:2> ] ) for x in troveTups ) <EOL> assert ( '<STR_LIT>' in flavors ) <EOL> assert ( '<STR_LIT>' in flavors ) <EOL> troveTups = _get ( None , VERSION_FILTER_LATEST , <EOL> FLAVOR_FILTER_AVAIL , [ '<STR_LIT>' ] ) <EOL> assert ( len ( troveTups ) == <NUM_LIT:1> ) <EOL> assert ( troveTups [ <NUM_LIT:0> ] [ <NUM_LIT:1> ] . branch ( ) == VFS ( '<STR_LIT>' ) ) <EOL> flavors = set ( str ( x [ <NUM_LIT:2> ] ) for x in troveTups ) <EOL> assert ( '<STR_LIT>' in flavors ) <EOL> def testQueryByPath ( self ) : <EOL> for troveName in '<STR_LIT>' , '<STR_LIT>' : <EOL> self . addComponent ( troveName , '<STR_LIT:1.0>' , '<STR_LIT>' , [ '<STR_LIT>' ] ) <EOL> self . addComponent ( troveName , '<STR_LIT:1.0>' , '<STR_LIT>' , [ '<STR_LIT>' ] ) <EOL> self . addComponent ( troveName , '<STR_LIT:1.0>' , '<STR_LIT>' , [ '<STR_LIT>' ] ) <EOL> self . addComponent ( troveName , '<STR_LIT:1.0>' , '<STR_LIT>' , [ '<STR_LIT>' ] ) <EOL> self . addComponent ( troveName , '<STR_LIT>' , '<STR_LIT>' , [ '<STR_LIT>' ] ) <EOL> self . addComponent ( troveName , '<STR_LIT>' , '<STR_LIT>' , [ '<STR_LIT>' ] ) <EOL> self . addComponent ( troveName , '<STR_LIT>' , '<STR_LIT>' , [ '<STR_LIT>' ] ) <EOL> repos = self . openRepository ( ) <EOL> targetFlavor = [ deps . parseFlavor ( '<STR_LIT>' ) ] <EOL> def _getByPath ( versionFilter , flavorFilter , pathList = [ '<STR_LIT>' ] ) : <EOL> return queryrep . getTrovesByPath ( repos , pathList , <EOL> versionFilter , flavorFilter , <EOL> self . cfg . installLabelPath , <EOL> targetFlavor ) <EOL> def _check ( tups , troveSpecs ) : <EOL> source = trovesource . SimpleTroveSource ( tups ) <EOL> source . searchAsDatabase ( ) <EOL> troveSpecs = [ cmdline . parseTroveSpec ( x ) for x in troveSpecs ] <EOL> results = source . findTroves ( None , troveSpecs ) <EOL> receivedTups = itertools . chain ( * results . itervalues ( ) ) <EOL> assert ( set ( receivedTups ) == set ( tups ) ) <EOL> assert ( len ( _getByPath ( VERSION_FILTER_ALL , FLAVOR_FILTER_ALL ) ) == <NUM_LIT> ) <EOL> tups = _getByPath ( VERSION_FILTER_LATEST , FLAVOR_FILTER_ALL ) <EOL> _check ( tups , [ '<STR_LIT>' , '<STR_LIT>' ] ) <EOL> tups = _getByPath ( VERSION_FILTER_LEAVES , FLAVOR_FILTER_ALL ) <EOL> assert ( len ( tups ) == <NUM_LIT:10> ) <EOL> tups = [ x for x in tups if x [ <NUM_LIT:0> ] == '<STR_LIT>' ] <EOL> _check ( tups , [ '<STR_LIT>' , '<STR_LIT>' , <EOL> '<STR_LIT>' , '<STR_LIT>' , <EOL> '<STR_LIT>' ] ) <EOL> tups = _getByPath ( VERSION_FILTER_ALL , FLAVOR_FILTER_AVAIL ) <EOL> assert ( len ( tups ) == <NUM_LIT:10> ) <EOL> tups = [ x for x in tups if x [ <NUM_LIT:0> ] == '<STR_LIT>' ] <EOL> _check ( tups , [ '<STR_LIT>' , '<STR_LIT>' , <EOL> '<STR_LIT>' , '<STR_LIT>' , <EOL> '<STR_LIT>' ] ) <EOL> tups = _getByPath ( VERSION_FILTER_ALL , FLAVOR_FILTER_BEST ) <EOL> tups = [ x for x in tups if x [ <NUM_LIT:0> ] == '<STR_LIT>' ] <EOL> _check ( tups , [ '<STR_LIT>' , '<STR_LIT>' , <EOL> '<STR_LIT>' ] ) <EOL> tups = _getByPath ( VERSION_FILTER_LEAVES , FLAVOR_FILTER_BEST ) <EOL> assert ( len ( tups ) == <NUM_LIT:2> ) <EOL> tups = [ x for x in tups if x [ <NUM_LIT:0> ] == '<STR_LIT>' ] <EOL> _check ( tups , [ '<STR_LIT>' ] ) <EOL> tups = _getByPath ( VERSION_FILTER_LATEST , FLAVOR_FILTER_BEST ) <EOL> assert ( len ( tups ) == <NUM_LIT:2> ) <EOL> _check ( tups , [ '<STR_LIT>' , '<STR_LIT>' ] ) <EOL> self . addComponent ( '<STR_LIT>' , '<STR_LIT:1.0>' , '<STR_LIT>' , [ '<STR_LIT>' ] ) <EOL> self . addComponent ( '<STR_LIT>' , '<STR_LIT:1.0>' , '<STR_LIT>' , [ '<STR_LIT>' ] ) <EOL> self . addComponent ( '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , [ '<STR_LIT>' ] ) <EOL> tups = _getByPath ( VERSION_FILTER_LATEST , FLAVOR_FILTER_BEST , <EOL> [ '<STR_LIT>' , '<STR_LIT>' ] ) <EOL> _check ( tups , [ '<STR_LIT>' , '<STR_LIT>' , <EOL> '<STR_LIT>' , '<STR_LIT>' ] ) <EOL> def testWhatProvides ( self ) : <EOL> targetFlavor = [ deps . parseFlavor ( '<STR_LIT>' ) ] <EOL> def _get ( versionFilter , flavorFilter , whatProvidesList ) : <EOL> return queryrep . getTrovesToDisplay ( repos , [ ] , [ ] , <EOL> [ deps . parseDep ( x ) for x in whatProvidesList ] , <EOL> versionFilter , <EOL> flavorFilter , <EOL> self . cfg . installLabelPath , <EOL> targetFlavor , None ) <EOL> self . addComponent ( '<STR_LIT>' , '<STR_LIT:1>' , '<STR_LIT>' ) <EOL> self . addComponent ( '<STR_LIT>' , '<STR_LIT:2>' , '<STR_LIT>' ) <EOL> self . addComponent ( '<STR_LIT>' , '<STR_LIT:2>' , '<STR_LIT>' ) <EOL> repos = self . openRepository ( ) <EOL> troveTups = _get ( VERSION_FILTER_LATEST , FLAVOR_FILTER_BEST , [ '<STR_LIT>' ] ) <EOL> assert ( len ( troveTups ) == <NUM_LIT:1> ) <EOL> troveTups = _get ( VERSION_FILTER_LATEST , FLAVOR_FILTER_ALL , [ '<STR_LIT>' ] ) <EOL> assert ( len ( troveTups ) == <NUM_LIT:2> ) <EOL> troveTups = _get ( VERSION_FILTER_ALL , FLAVOR_FILTER_ALL , [ '<STR_LIT>' ] ) <EOL> assert ( len ( troveTups ) == <NUM_LIT:2> ) <EOL> def testBuildLogDisplay ( self ) : <EOL> buildlog = '<STR_LIT>' ; <EOL> bz2compressor = bz2 . BZ2Compressor ( ) <EOL> bz2compressor . compress ( buildlog ) <EOL> contents = bz2compressor . flush ( ) <EOL> self . addComponent ( '<STR_LIT>' ) <EOL> self . addComponent ( '<STR_LIT>' , [ ( '<STR_LIT>' , rephelp . RegularFile ( contents = contents , tags = [ '<STR_LIT>' ] ) ) ] ) <EOL> self . addCollection ( '<STR_LIT:foo>' , [ ( '<STR_LIT>' , True ) , ( '<STR_LIT>' , False ) ] ) <EOL> repos = self . openRepository ( ) <EOL> output = self . captureOutput ( queryrep . displayTroves , self . cfg , [ '<STR_LIT:foo>' ] , [ ] , [ ] , <EOL> queryrep . VERSION_FILTER_LATEST , queryrep . FLAVOR_FILTER_BEST , showBuildLog = True ) <EOL> self . assertEqual ( output [ <NUM_LIT:1> ] , buildlog ) <EOL> def testShowFile ( self ) : <EOL> contents1 = '<STR_LIT>' ; <EOL> contents2 = '<STR_LIT>' ; <EOL> self . addComponent ( '<STR_LIT>' , [ ( '<STR_LIT>' , contents1 ) , ( '<STR_LIT>' , contents2 ) ] ) <EOL> self . addCollection ( '<STR_LIT:foo>' , [ '<STR_LIT>' ] ) <EOL> repos = self . openRepository ( ) <EOL> output = self . captureOutput ( queryrep . displayTroves , self . cfg , [ '<STR_LIT:foo>' ] , [ ] , [ ] , <EOL> queryrep . VERSION_FILTER_LATEST , queryrep . FLAVOR_FILTER_BEST , filesToShow = [ '<STR_LIT>' ] ) <EOL> self . assertEqual ( output [ <NUM_LIT:1> ] , contents2 ) <EOL> def testRdiff1 ( self ) : <EOL> req1 = '<STR_LIT>' <EOL> req2 = '<STR_LIT>' <EOL> req3 = '<STR_LIT>' <EOL> prov1 = "<STR_LIT>" <EOL> prov2 = "<STR_LIT>" <EOL> prov3 = "<STR_LIT>" <EOL> buildReqs1 = [ ( '<STR_LIT>' , '<STR_LIT:1>' , '<STR_LIT>' ) , ( '<STR_LIT>' , '<STR_LIT:1>' , '<STR_LIT>' ) , <EOL> ( '<STR_LIT>' , '<STR_LIT:1>' , '<STR_LIT>' ) ] <EOL> buildReqs2 = [ ( '<STR_LIT>' , '<STR_LIT:1>' , '<STR_LIT>' ) , ( '<STR_LIT>' , '<STR_LIT:1>' , '<STR_LIT>' ) , <EOL> ( '<STR_LIT>' , '<STR_LIT:2>' , '<STR_LIT>' ) ] <EOL> rf1 = rephelp . RegularFile ( contents = '<STR_LIT>' , <EOL> perms = <NUM_LIT:0> <NUM_LIT> , provides = prov1 , requires = req1 , <EOL> mtime = <NUM_LIT> , ) <EOL> rf2 = rephelp . RegularFile ( contents = '<STR_LIT>' , <EOL> perms = <NUM_LIT:0> <NUM_LIT> , provides = prov2 , requires = req2 , <EOL> mtime = <NUM_LIT> , tags = [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ] ) <EOL> rf3 = rephelp . RegularFile ( contents = '<STR_LIT>' , <EOL> perms = <NUM_LIT:0> <NUM_LIT> , provides = prov3 , requires = req3 , <EOL> mtime = <NUM_LIT> ) <EOL> rf5 = rephelp . RegularFile ( contents = '<STR_LIT>' , <EOL> perms = <NUM_LIT:0> <NUM_LIT> , provides = prov1 , requires = req1 , <EOL> mtime = <NUM_LIT> , tags = [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ] ) <EOL> self . addComponent ( '<STR_LIT>' , '<STR_LIT:1>' , '<STR_LIT>' , <EOL> [ ( '<STR_LIT>' , rf1 ) , <EOL> ( '<STR_LIT>' , rf2 ) , <EOL> ( '<STR_LIT>' , rf1 ) , <EOL> ] ) <EOL> self . addComponent ( '<STR_LIT>' , '<STR_LIT:1>' , '<STR_LIT>' , <EOL> [ ( '<STR_LIT>' , rf1 ) ] ) <EOL> self . addCollection ( '<STR_LIT:foo>' , '<STR_LIT:1>' , <EOL> [ ( x , '<STR_LIT:1>' , '<STR_LIT>' ) for x in [ '<STR_LIT>' , '<STR_LIT>' ] ] , <EOL> buildReqs = buildReqs1 ) <EOL> self . addComponent ( '<STR_LIT>' , '<STR_LIT:2>' , '<STR_LIT>' , <EOL> [ ( '<STR_LIT>' , rf2 ) , <EOL> ( '<STR_LIT>' , rf5 ) , <EOL> ( '<STR_LIT>' , rf3 ) , ] ) <EOL> self . addComponent ( '<STR_LIT>' , '<STR_LIT:2>' , '<STR_LIT>' , <EOL> [ ( '<STR_LIT>' , rf2 ) ] ) <EOL> self . addCollection ( '<STR_LIT:foo>' , '<STR_LIT:2>' , <EOL> [ ( x , '<STR_LIT:2>' , '<STR_LIT>' ) for x in [ '<STR_LIT>' , '<STR_LIT>' ] ] , <EOL> buildReqs = buildReqs2 ) <EOL> self . cfg . flavor = [ deps . parseFlavor ( '<STR_LIT>' ) ] <EOL> repos = self . openRepository ( ) <EOL> troveSpec = '<STR_LIT>' <EOL> ret , outs = self . _rdiff ( troveSpec ) <EOL> self . assertEqual ( outs , expOutput1noargs ) <EOL> self . cfg . fullFlavors = True <EOL> ret , outs = self . _rdiff ( troveSpec ) <EOL> self . assertEqual ( outs , expOutput1fullFlavors ) <EOL> self . cfg . fullFlavors = False <EOL> self . cfg . fullVersions = True <EOL> ret , outs = self . _rdiff ( troveSpec ) <EOL> self . assertEqual ( outs , expOutput1fullVersions ) <EOL> self . cfg . fullVersions = False <EOL> ret , outs = self . _rdiff ( troveSpec , ls = True ) <EOL> self . assertEqual ( outs , expOutput1withFiles ) <EOL> ret , outs = self . _rdiff ( troveSpec , fileVersions = True ) <EOL> self . assertEqual ( outs , expOutput1withFileVersions ) <EOL> ret , outs = self . _rdiff ( troveSpec , lsl = True ) <EOL> self . assertEqual ( outs , expOutput1withFilesStat ) <EOL> ret , outs = self . _rdiff ( troveSpec , tags = True ) <EOL> self . assertEqual ( outs , expOutput1withFileTags ) <EOL> troveSpec = '<STR_LIT>' <EOL> ret , outs = self . _rdiff ( troveSpec , tags = True ) <EOL> self . assertEqual ( outs , '<STR_LIT>' ) <EOL> def testRdiff2 ( self ) : <EOL> req1 = '<STR_LIT>' <EOL> req2 = '<STR_LIT>' <EOL> prov1 = "<STR_LIT>" <EOL> prov2 = "<STR_LIT>" <EOL> rf1 = rephelp . RegularFile ( contents = '<STR_LIT>' , <EOL> perms = <NUM_LIT:0> <NUM_LIT> , provides = prov1 , requires = req1 , <EOL> mtime = <NUM_LIT> , ) <EOL> rf2 = rephelp . RegularFile ( contents = '<STR_LIT>' , <EOL> perms = <NUM_LIT:0> <NUM_LIT> , provides = prov2 , requires = req2 , <EOL> mtime = <NUM_LIT> , tags = [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ] ) <EOL> self . addComponent ( '<STR_LIT>' , '<STR_LIT:1>' , '<STR_LIT>' , [ ( '<STR_LIT>' , rf1 ) ] ) <EOL> self . addComponent ( '<STR_LIT>' , '<STR_LIT:1>' , '<STR_LIT>' , [ ( '<STR_LIT>' , rf2 ) ] ) <EOL> self . addCollection ( '<STR_LIT:foo>' , '<STR_LIT:1>' , <EOL> [ ( x , '<STR_LIT:1>' , '<STR_LIT>' ) for x in [ '<STR_LIT>' , '<STR_LIT>' ] ] ) <EOL> self . addComponent ( '<STR_LIT>' , '<STR_LIT:1>' , [ ( '<STR_LIT>' , rf1 ) ] ) <EOL> self . addCollection ( '<STR_LIT:bar>' , '<STR_LIT:1>' , [ '<STR_LIT>' ] ) <EOL> self . addCollection ( '<STR_LIT>' , '<STR_LIT:1>' , [ '<STR_LIT:bar>' ] ) <EOL> self . addCollection ( '<STR_LIT>' , '<STR_LIT:1>' , <EOL> [ ( '<STR_LIT:foo>' , '<STR_LIT:1>' , '<STR_LIT>' ) , '<STR_LIT>' ] ) <EOL> self . addComponent ( '<STR_LIT>' , '<STR_LIT:2>' , '<STR_LIT>' , [ ( '<STR_LIT>' , rf1 ) ] ) <EOL> self . addComponent ( '<STR_LIT>' , '<STR_LIT:2>' , '<STR_LIT>' , [ ( '<STR_LIT>' , rf2 ) ] ) <EOL> self . addCollection ( '<STR_LIT:foo>' , '<STR_LIT:2>' , <EOL> [ ( x , '<STR_LIT:2>' , '<STR_LIT>' ) for x in [ '<STR_LIT>' , '<STR_LIT>' ] ] ) <EOL> self . addCollection ( '<STR_LIT>' , '<STR_LIT:2>' , [ ( '<STR_LIT:foo>' , '<STR_LIT:2>' , '<STR_LIT>' ) , <EOL> ( '<STR_LIT>' , '<STR_LIT:1>' , '<STR_LIT>' ) ] ) <EOL> troveSpec = '<STR_LIT>' <EOL> ret , outs = self . _rdiff ( troveSpec ) <EOL> self . assertEqual ( outs , expOutput2 ) <EOL> def testRdiff3 ( self ) : <EOL> rf1 = rephelp . RegularFile ( contents = '<STR_LIT>' , <EOL> perms = <NUM_LIT:0> <NUM_LIT> , mtime = <NUM_LIT> ) <EOL> lf1 = rephelp . Symlink ( "<STR_LIT>" ) <EOL> self . addComponent ( '<STR_LIT>' , '<STR_LIT:1>' , [ ( '<STR_LIT>' , rf1 ) ] ) <EOL> self . addCollection ( '<STR_LIT:foo>' , '<STR_LIT:1>' , [ '<STR_LIT>' ] ) <EOL> self . addComponent ( '<STR_LIT>' , '<STR_LIT:2>' , <EOL> [ ( '<STR_LIT>' , rf1 ) , ( '<STR_LIT>' , lf1 ) ] ) <EOL> self . addCollection ( '<STR_LIT:foo>' , '<STR_LIT:2>' , [ '<STR_LIT>' ] ) <EOL> ret , outs = self . _rdiff ( '<STR_LIT>' , lsl = True ) <EOL> outs = re . sub ( "<STR_LIT>" , "<STR_LIT>" , outs ) <EOL> self . assertEqual ( outs , expOutput3 ) <EOL> def testRdiff4 ( self ) : <EOL> req1 = '<STR_LIT>' <EOL> req2 = '<STR_LIT>' <EOL> prov1 = "<STR_LIT>" <EOL> prov2 = "<STR_LIT>" <EOL> rf1 = rephelp . RegularFile ( contents = '<STR_LIT>' , <EOL> perms = <NUM_LIT:0> <NUM_LIT> , provides = prov1 , requires = req1 , <EOL> mtime = <NUM_LIT> , ) <EOL> rf2 = rephelp . RegularFile ( contents = '<STR_LIT>' , <EOL> perms = <NUM_LIT:0> <NUM_LIT> , provides = prov2 , requires = req2 , <EOL> mtime = <NUM_LIT> , tags = [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ] ) <EOL> self . addComponent ( '<STR_LIT>' , '<STR_LIT:1>' , [ ( '<STR_LIT>' , rf1 ) ] ) <EOL> self . addCollection ( '<STR_LIT:foo>' , '<STR_LIT:1>' , [ '<STR_LIT>' ] ) <EOL> self . addComponent ( '<STR_LIT>' , '<STR_LIT:2>' , [ ( '<STR_LIT>' , rf2 ) ] ) <EOL> self . addCollection ( '<STR_LIT:foo>' , '<STR_LIT:2>' , [ '<STR_LIT>' ] ) <EOL> ret , outs = self . _rdiff ( '<STR_LIT>' ) <EOL> self . assertEqual ( outs , expOutput4 ) <EOL> ret , outs = self . _rdiff ( '<STR_LIT>' , deps = True ) <EOL> self . assertEqual ( outs , expOutput4withTroveDeps ) <EOL> def testRdiff5 ( self ) : <EOL> flv1 = '<STR_LIT>' <EOL> flv2 = '<STR_LIT>' <EOL> rf11 = rephelp . RegularFile ( contents = '<STR_LIT>' , <EOL> flavor = flv1 ) <EOL> rf12 = rephelp . RegularFile ( contents = '<STR_LIT>' , <EOL> flavor = flv2 ) <EOL> rf21 = rephelp . RegularFile ( contents = '<STR_LIT>' , <EOL> flavor = flv1 ) <EOL> rf22 = rephelp . RegularFile ( contents = '<STR_LIT>' , <EOL> flavor = flv2 ) <EOL> files = [ ( rf11 , rf12 ) , ( rf21 , rf22 ) ] <EOL> for v , fileobjs in zip ( [ '<STR_LIT:1>' , '<STR_LIT:2>' ] , files ) : <EOL> file1 = fileobjs [ <NUM_LIT:0> ] <EOL> file2 = fileobjs [ <NUM_LIT:1> ] <EOL> t1 = self . addComponent ( '<STR_LIT>' , v , fileContents = [ ( '<STR_LIT>' , file1 ) ] ) <EOL> p1 = self . addCollection ( '<STR_LIT:foo>' , v , [ ( '<STR_LIT>' , v , t1 . getFlavor ( ) ) ] ) <EOL> t2 = self . addComponent ( '<STR_LIT>' , v , fileContents = [ ( '<STR_LIT>' , file2 ) ] ) <EOL> p2 = self . addCollection ( '<STR_LIT:foo>' , v , [ ( '<STR_LIT>' , v , t2 . getFlavor ( ) ) ] ) <EOL> self . addCollection ( '<STR_LIT>' , v , <EOL> [ ( '<STR_LIT:foo>' , v , flv1 ) , ( '<STR_LIT:foo>' , v , flv2 ) ] ) <EOL> troveSpec = '<STR_LIT>' <EOL> self . cfg . fullFlavors = True <EOL> ret , outs = self . _rdiff ( troveSpec ) <EOL> self . cfg . fullFlavors = False <EOL> self . assertEqual ( outs , expOutput5 ) <EOL> def testRdiff6 ( self ) : <EOL> self . addComponent ( '<STR_LIT>' , '<STR_LIT:1>' , filePrimer = <NUM_LIT:1> ) <EOL> self . addCollection ( '<STR_LIT:foo>' , '<STR_LIT:1>' , [ '<STR_LIT>' ] ) <EOL> self . addComponent ( '<STR_LIT>' , '<STR_LIT:1>' , filePrimer = <NUM_LIT:1> ) <EOL> self . addCollection ( '<STR_LIT>' , '<STR_LIT:1>' , [ '<STR_LIT>' ] ) <EOL> self . addComponent ( '<STR_LIT>' , '<STR_LIT:1>' , filePrimer = <NUM_LIT:1> ) <EOL> self . addCollection ( '<STR_LIT>' , '<STR_LIT:1>' , [ '<STR_LIT>' ] ) <EOL> self . addCollection ( '<STR_LIT>' , '<STR_LIT:1>' , <EOL> [ ( '<STR_LIT:foo>' , '<STR_LIT:1>' ) , ( '<STR_LIT>' , '<STR_LIT:1>' ) ] ) <EOL> self . addCollection ( '<STR_LIT>' , '<STR_LIT:2>' , <EOL> [ ( '<STR_LIT:foo>' , '<STR_LIT:1>' ) , ( '<STR_LIT>' , '<STR_LIT:1>' ) ] ) <EOL> troveSpec = '<STR_LIT>' <EOL> ret , outs = self . _rdiff ( troveSpec ) <EOL> self . assertEqual ( outs , expOutput6 ) <EOL> def testRdiff8 ( self ) : <EOL> raise testhelp . SkipTestException ( "<STR_LIT>" ) <EOL> rf1 = rephelp . RegularFile ( contents = '<STR_LIT>' , <EOL> perms = <NUM_LIT:0> <NUM_LIT> , mtime = <NUM_LIT> , ) <EOL> rf2 = rephelp . RegularFile ( contents = '<STR_LIT>' , <EOL> perms = <NUM_LIT:0> <NUM_LIT> , mtime = <NUM_LIT> , ) <EOL> v1 = versions . ThawVersion ( '<STR_LIT>' ) <EOL> v2 = versions . ThawVersion ( '<STR_LIT>' ) <EOL> self . openRepository ( ) <EOL> self . openRepository ( <NUM_LIT:1> ) <EOL> self . addComponent ( '<STR_LIT>' , v1 , [ ( '<STR_LIT>' , rf1 ) ] ) <EOL> self . addCollection ( '<STR_LIT:foo>' , v1 , [ '<STR_LIT>' ] ) <EOL> self . addComponent ( '<STR_LIT>' , v2 , [ ( '<STR_LIT>' , rf2 ) ] ) <EOL> self . addCollection ( '<STR_LIT:foo>' , v2 , [ '<STR_LIT>' ] ) <EOL> troveSpec = cmdline . parseChangeList ( '<STR_LIT>' % ( v1 , v2 ) ) [ <NUM_LIT:0> ] <EOL> ret , outs = self . captureOutput ( queryrep . diffTroves , <EOL> self . cfg , troveSpec ) <EOL> self . assertEqual ( outs , '<STR_LIT>' ) <EOL> def testRdiff9 ( self ) : <EOL> """<STR_LIT>""" <EOL> rf1 = rephelp . RegularFile ( contents = '<STR_LIT>' , <EOL> perms = <NUM_LIT:0> <NUM_LIT> , mtime = <NUM_LIT> , config = False ) <EOL> rf2 = rephelp . RegularFile ( contents = '<STR_LIT>' , <EOL> perms = <NUM_LIT:0> <NUM_LIT> , mtime = <NUM_LIT> , config = True ) <EOL> self . addComponent ( '<STR_LIT>' , '<STR_LIT:1>' , [ ( '<STR_LIT>' , rf1 ) ] ) <EOL> self . addComponent ( '<STR_LIT>' , '<STR_LIT:2>' , [ ( '<STR_LIT>' , rf2 ) ] ) <EOL> ret , outs = self . _rdiff ( '<STR_LIT>' , asDiff = True ) <EOL> self . assertEqual ( outs , expOutput9 ) <EOL> expOutput1noargs = """<STR_LIT>""" <EOL> expOutput1fullFlavors = """<STR_LIT>""" <EOL> expOutput1fullVersions = """<STR_LIT>""" <EOL> expOutput1withFiles = """<STR_LIT>""" <EOL> expOutput1withFileVersions = """<STR_LIT>""" <EOL> expOutput1withFilesStat = """<STR_LIT>""" <EOL> expOutput1withFileTags = """<STR_LIT>""" <EOL> expOutput2 = """<STR_LIT>""" <EOL> expOutput3 = """<STR_LIT>""" <EOL> expOutput4 = """<STR_LIT>""" <EOL> expOutput4withTroveDeps = """<STR_LIT>""" <EOL> expOutput5 = """<STR_LIT>""" <EOL> expOutput6 = """<STR_LIT>""" <EOL> expOutput9 = """<STR_LIT>""" <EOL> class MultiRepQueryTest ( rephelp . RepositoryHelper ) : <EOL> def setUp ( self ) : <EOL> rephelp . RepositoryHelper . setUp ( self ) <EOL> def tearDown ( self ) : <EOL> self . servers . stopServer ( <NUM_LIT:1> ) <EOL> self . servers . stopServer ( <NUM_LIT:0> ) <EOL> def _rdiff ( self , troveSpec , ** kwargs ) : <EOL> client = conaryclient . ConaryClient ( self . cfg ) <EOL> return self . captureOutput ( queryrep . rdiffCommand , self . cfg , <EOL> client , client . getDatabase ( ) , troveSpec , <EOL> ** kwargs ) <EOL> def _openRepository ( self , idx , serverName = "<STR_LIT:localhost>" ) : <EOL> label = versions . Label ( "<STR_LIT>" % serverName ) <EOL> self . servers . stopServer ( idx ) <EOL> repo = self . openRepository ( idx , serverName = [ serverName ] ) <EOL> self . resetRepository ( idx ) <EOL> self . addUserAndRole ( repo , label , "<STR_LIT:user>" , "<STR_LIT>" ) <EOL> repo . addAcl ( label , "<STR_LIT:user>" , None , None , write = True , remove = True ) <EOL> return repo <EOL> def testRdiffMulti ( self ) : <EOL> r0 = self . _openRepository ( <NUM_LIT:0> , "<STR_LIT:localhost>" ) <EOL> r1 = self . _openRepository ( <NUM_LIT:1> , "<STR_LIT>" ) <EOL> c = self . getRepositoryClient ( "<STR_LIT:user>" , "<STR_LIT>" ) <EOL> self . addComponent ( "<STR_LIT>" , "<STR_LIT>" , repos = c ) <EOL> self . addComponent ( "<STR_LIT>" , "<STR_LIT>" , repos = c ) <EOL> trv = self . addCollection ( "<STR_LIT>" , "<STR_LIT>" , [ "<STR_LIT>" , "<STR_LIT>" ] , repos = c ) <EOL> grpfuu = self . addCollection ( "<STR_LIT>" , "<STR_LIT>" , [ trv . getNameVersionFlavor ( ) ] , repos = c ) <EOL> grpfoo1 = self . addCollection ( "<STR_LIT>" , "<STR_LIT>" , [ grpfuu . getNameVersionFlavor ( ) ] , repos = c ) <EOL> grpfoo2 = self . addCollection ( "<STR_LIT>" , "<STR_LIT>" , [ trv . getNameVersionFlavor ( ) ] , repos = c ) <EOL> ret , outs = self . _rdiff ( <EOL> '<STR_LIT>' ) <EOL> self . assertEqual ( outs , expOutput7 ) <EOL> expOutput7 = """<STR_LIT>""" </s>
