Exemple #1
0
    def add_filesets(self, project_dto):
        for fileset in project_dto.filesets:
            logging.debug(fileset)

            if fileset.type == 'local-file':
                fs = LocalFileSet(self.name, fileset.name, fileset.url,
                                  fileset.target)
            elif fileset.type == 'compressed':
                fs = CompressedFileSet(self.name, fileset.name, fileset.url,
                                       fileset.target)
                fs.set_pattern(fileset.pattern)
            elif fileset.type == 'bazaar':
                fs = BazaarFileSet(self.name, fileset.name, fileset.url,
                                   fileset.target)
                fs.set_pattern(fileset.pattern)
            elif fileset.type == 'transifex':
                fs = TransifexFileSet(self.name, fileset.name, fileset.url,
                                      fileset.target)
            elif fileset.type == 'transifexhub':
                fs = TransifexHubFileSet(self.name, fileset.name, fileset.url,
                                         fileset.target)
                fs.set_project(self)
            elif fileset.type == 'local-dir':
                fs = LocalDirFileSet(self.name, fileset.name, fileset.url,
                                     fileset.target)
            elif fileset.type == 'file':
                fs = FileFileSet(self.name, fileset.name, fileset.url,
                                 fileset.target)
            elif fileset.type == 'subversion':
                fs = SubversionFileSet(self.name, fileset.name, fileset.url,
                                       fileset.target)
            elif fileset.type == 'crawl':
                fs = CrawlFileSet(self.name, fileset.name, fileset.url,
                                  fileset.target)
                fs.set_pattern(fileset.pattern)
            elif fileset.type == 'git':
                fs = GitFileSet(self.name, fileset.name, fileset.url,
                                fileset.target)
                fs.set_pattern(fileset.pattern)
            elif fileset.type == 'gerrit-directory':
                fs = GerritDirectoryFileSet(self.name, fileset.name,
                                            fileset.url, fileset.target)
                fs.set_pattern(fileset.pattern)
                fs.set_project(self)
            else:
                msg = 'Unsupported filetype: {0}'
                logging.error(msg.format(fileset.type))

            self.add(fs)
            fs.add_excluded(fileset.excluded)
 def test_has_filename_path(self):
     bazaar = BazaarFileSet('project', 'lp:~mailman-l10n-ca/', 'none.po')
     self.assertFalse(bazaar._has_filename())
 def test_has_filename_filename(self):
     bazaar = BazaarFileSet(
         'project',
         'lp:~mailman-l10n-ca/mailman.po',
         'none.po')
     self.assertTrue(bazaar._has_filename())