Пример #1
0
def process_commits(options):
    path, ref_id, shas = options
    c = Commits(index.Connector())
    logger.info("Worker %s started to extract and index %s commits" %
                (mp.current_process(), len(shas)))
    buf = get_commits_desc(path, shas)
    c.add_commits(process_commits_desc_output(buf, ref_id))
Пример #2
0
    def setUpClass(cls):
        cls.con = index.Connector(index='repoxplorertest')
        cls.conp = index.Connector(index='repoxplorertest',
                                   index_suffix='projects')
        c = Commits(cls.con)
        c.add_commits(COMMITS)
        projects_file = """
        project-templates:
          default:
            uri: https://github.com/nakata/%(name)s.git
            branches:
            - master

        projects:
          test:
            repos:
              monkey:
                template: default
          test2:
            repos:
              monkey:
                template: default
                tags:
                  - python
        """
        cls.db = set_projects_definition(cls.conp, projects_file)
Пример #3
0
 def setUpClass(cls):
     cls.con = index.Connector(index='repoxplorertest')
     cls.conp = index.Connector(index='repoxplorertest',
                                index_suffix='projects')
     c = Commits(cls.con)
     c.add_commits(COMMITS)
     cls.db = set_projects_definition(cls.conp)
Пример #4
0
 def setUpClass(cls):
     cls.con = index.Connector(index='repoxplorertest')
     cls.conp = index.Connector(
         index='repoxplorertest', index_suffix='projects')
     c = Commits(cls.con)
     c.add_commits(COMMITS)
     cls.db = set_projects_definition(cls.conp)
Пример #5
0
 def setUpClass(cls):
     cls.con = index.Connector(index='repoxplorertest')
     cls.conp = index.Connector(
         index='repoxplorertest', index_suffix='projects')
     c = Commits(cls.con)
     c.add_commits(COMMITS)
     cls.db = set_projects_definition(cls.conp)
     t = Tags(index.Connector(
         index='repoxplorertest', index_suffix='tags'))
     tags = [
         {
             'sha': '3597334f2cb10772950c97ddf2f6cc17b184',
             'date': 1410456005,
             'repo':
                 'https://github.com/nakata/monkey.git:monkey',
             'name': 'tag1',
         },
         {
             'sha': '3597334f2cb10772950c97ddf2f6cc17b1845',
             'date': 1410456005,
             'repo':
                 'https://github.com/nakata/monkey.git:monkey',
             'name': 'tag2',
         }]
     t.add_tags(tags)
Пример #6
0
    def setUpClass(cls):
        cls.con = index.Connector(index='repoxplorertest')
        cls.conp = index.Connector(
            index='repoxplorertest', index_suffix='projects')
        c = Commits(cls.con)
        c.add_commits(COMMITS)
        projects_file = """
        project-templates:
          default:
            uri: https://github.com/nakata/%(name)s.git
            branches:
            - master

        projects:
          test:
            repos:
              monkey:
                template: default
          test2:
            repos:
              monkey:
                template: default
                tags:
                  - python
        """
        cls.db = set_projects_definition(cls.conp, projects_file)
Пример #7
0
 def setUpClass(cls):
     cls.con = index.Connector(index='repoxplorertest')
     cls.conp = index.Connector(
         index='repoxplorertest', index_suffix='projects')
     c = Commits(cls.con)
     c.add_commits(COMMITS)
     cls.db = set_projects_definition(cls.conp)
     t = Tags(index.Connector(
         index='repoxplorertest', index_suffix='tags'))
     tags = [
         {
             'sha': '3597334f2cb10772950c97ddf2f6cc17b184',
             'date': 1410456005,
             'repo':
                 'https://github.com/nakata/monkey.git:monkey',
             'name': 'tag1',
         },
         {
             'sha': '3597334f2cb10772950c97ddf2f6cc17b1845',
             'date': 1410456005,
             'repo':
                 'https://github.com/nakata/monkey.git:monkey',
             'name': 'tag2',
         }]
     t.add_tags(tags)
Пример #8
0
 def setUp(self):
     FunctionalTest.setUp(self)
     self.con = index.Connector(index='repoxplorertest')
     self.conp = index.Connector(index='repoxplorertest',
                                 index_suffix='projects')
     c = Commits(self.con)
     c.add_commits(COMMITS)
     self.db = set_projects_definition(self.conp)
Пример #9
0
 def setUp(self):
     FunctionalTest.setUp(self)
     self.con = index.Connector(index='repoxplorertest')
     self.conp = index.Connector(
         index='repoxplorertest', index_suffix='projects')
     c = Commits(self.con)
     c.add_commits(COMMITS)
     self.db = set_projects_definition(self.conp)
Пример #10
0
def process_commits(options):
    path, ref_ids, shas = options
    if not isinstance(ref_ids, list):
        ref_ids = [ref_ids]
    c = Commits(index.Connector())
    logger.info("Worker %s started to extract and index %s commits" % (
        mp.current_process(), len(shas)))
    buf = get_commits_desc(path, shas)
    c.add_commits(process_commits_desc_output(buf, ref_ids))
Пример #11
0
    for i in xrange(amount):
        author_date = random.randint(epoch_start, epoch_start + 1000000)
        author = emails[random.randint(0, email_amount - 1)]
        committer = emails[random.randint(0, email_amount - 1)]
        c = {}
        c['sha'] = hashlib.sha256(create_random_str(10)).hexdigest()
        c['author_name'] = author[0]
        c['committer_name'] = committer[0]
        c['author_email'] = author[1]
        c['committer_email'] = committer[1]
        c['author_date'] = author_date
        c['committer_date'] = random.randint(author_date + 1,
                                             author_date + 10000)
        c['ttl'] = random.randint(0, 10000)
        c['commit_msg'] = gen_commit_msg()
        c['line_modifieds'] = random.randint(0, 10000)
        c['merge_commit'] = False
        c['projects'] = [
            project,
        ]
        ret.append(c)
    print "Generation of %s fake commits done." % amount
    return ret


if __name__ == '__main__':
    amount = 100000
    c = Commits(index.Connector())
    c.add_commits(gen_fake_commits(amount))
    print "Indexation done."
Пример #12
0
    ret = []
    for i in range(amount):
        author_date = random.randint(
            epoch_start, epoch_start + 1000000)
        author = emails[random.randint(0, email_amount - 1)]
        committer = emails[random.randint(0, email_amount - 1)]
        c = {}
        c['sha'] = hashlib.sha256(create_random_str(10)).hexdigest()
        c['author_name'] = author[0]
        c['committer_name'] = committer[0]
        c['author_email'] = author[1]
        c['committer_email'] = committer[1]
        c['author_date'] = author_date
        c['committer_date'] = random.randint(
            author_date + 1, author_date + 10000)
        c['ttl'] = random.randint(0, 10000)
        c['commit_msg'] = gen_commit_msg()
        c['line_modifieds'] = random.randint(0, 10000)
        c['merge_commit'] = False
        c['projects'] = [project, ]
        ret.append(c)
    print("Generation of %s fake commits done." % amount)
    return ret


if __name__ == '__main__':
    amount = 100000
    c = Commits(index.Connector())
    c.add_commits(gen_fake_commits(amount))
    print("Indexation done.")