Beispiel #1
0
def addRepoToRedis(repo):
    redisRepo = None
    
    if not repoExists(repo.owner.login, repo.name):          
        redisRepo = addNewRepo(repo)
        log(WarningLevels.Info, "New Repo %s/%s added to Redis"%(repo.owner.login, repo.name))  
        
    return redisRepo
Beispiel #2
0
def checkForValidEvent(gh, event):    
    if event.type == 'PushEvent':
        repo = event.repo
        username = repo.name.split('/', 1)[0]
        reponame = repo.name.split('/', 1)[1]
        
        if not repoExists(username, reponame):
            try:
                chosenRepo = gh.repos.get(username, reponame)
                if chosenRepo.has_issues and not chosenRepo.fork \
                    and chosenRepo.size <= int(settings.maxRepoSize):
                    return chosenRepo
            except:
                pass
            
    return None
Beispiel #3
0
    def setup(self):
        # get a repo with a unicode author string

        targetRepo = GithubRepo('nnombela','graph.js')
        # self.repo = Repo()
        # print "repoexists"
        gh = Github(login = settings.ghLogin, password = settings.ghPassword)

        loaded = repoExists(targetRepo.user, targetRepo.repo)
        # loaded = self.repo.loadFromKey('repos::%s/%s' % ('nnombela', 'graph.js'))
        if loaded == False:
            print "cloning"
            ghr = getGithubRepos(gh, [targetRepo])[0]
            self.repo = addRepoToRedis(ghr)
            
            # if self.repo:
            #     checkoutRepo(repo)
            #     parseRepoForTodos(repo)
            #     deleteLocalRepo(repo)
        else:
            self.repo = Repo()
            self.repo.loadFromKey('repos::%s/%s' % targetRepo)
Beispiel #4
0
 def test_repoExists(self):
     missingRepo = GithubRepo('github', 'testingderp')
     exists = repoExists(missingRepo.user, missingRepo.repo)
     assert exists == False