def iterFilesInTrove(self, n, v, f, sortByPath=False, withFiles=False,
                         capsules = False):
        try:
            cs = self.troveCsMap[n,v,f]
        except __HOLE__:
            raise errors.TroveMissing(n, v)

        trvCs = cs.getNewTroveVersion(n,v,f)
        fileList = trvCs.getNewFileList()
        if not fileList:
            return

        if capsules:
            fileList = [ x for x in fileList if x[0] == trove.CAPSULE_PATHID ]
        else:
            fileList = [ x for x in fileList if x[0] != trove.CAPSULE_PATHID ]

        if not withFiles:
            if sortByPath:
                for item in sorted(fileList):
                    yield item
            else:
                for item in fileList:
                    yield item
            return

        if sortByPath:
            # files stored in changesets are sorted by pathId, and must be
            # retrieved in that order.  But we want to display them by
            # path.  So, retrieve the info from the changeset by pathId
            # and stored it in a dict to be retrieved after sorting by
            # path
            changes = {}
            for pathId, path, fileId, version in fileList:
                changes[pathId] = cs.getFileChange(None, fileId)

            fileList = sorted(fileList, key=lambda x: x[1])

        for pathId, path, fileId, version in fileList:
            change = changes[pathId]
            if change is None:
                fileObj = None
            else:
                fileObj = files.ThawFile(change, pathId)
            yield pathId, path, fileId, version, fileObj
dataset/ETHPy150Open sassoftware/conary/conary/repository/trovesource.py/ChangesetFilesTroveSource.iterFilesInTrove