def main(args): django.setup() for repo in GitRepo.objects.all(): # repo is disabled if repo.status == False: continue git = GitTree(repo.name, repo.dirname(), repo.url, repo.commit, repo.stable) otag = git.get_tag() if git.check_update() == False and repo.delta == True: rtags = GitTag.objects.filter(repo = repo, name = otag) if len(rtags) > 0: rtag = rtags[0] rtag.flist = '' rtag.save() continue # update build tree _burl = "file://%s" % repo.dirname() buildgit = GitTree(repo.name, repo.builddir(), _burl, repo.commit, repo.stable) buildgit.update() # the tag name after git pull ntag = git.get_tag() if otag is None: otag = ntag if git.is_linux_next() == True: tag = ntag else: tag = otag if tag != ntag: # we got a new tag, just scan from last commit to otag # as common, new tag is the last commit, so does not need # to scan twice commit = git.get_commit_by_tag(ntag) else: commit = git.get_commit() if git.is_linux_next() == True and commit == git.get_stable(): # we update linux-next tree failed continue # if delta scan is enbled, skip the first time since we git clone # the tree, treat there is no file change if repo.delta == True: if repo.commit is None or len(repo.commit) == 0: repo.commit = commit repo.save() continue # no file change if repo.commit == commit: continue # file change list from last update flists = git.get_changelist(repo.commit, commit, repo.update) tags = GitTag.objects.filter(repo = repo, name = tag) rtag = None if tags.count() == 0: rtag = GitTag(repo = repo, name = tag, flist = ','.join(flists), total = 0) rtag.save() else: rtag = tags[0] if rtag.running == True: continue rtag.running = True rtag.save() print "Check for repo %s" % os.path.basename(repo.url) try: pcount = check_patch(repo, git, rtag, flists, commit) except: pass rtag.total += pcount rtag.flist = ','.join(flists) rtag.running = False rtag.save() repo.commit = commit if git.is_linux_next(): repo.stable = git.get_stable() repo.update = git.get_update_date() repo.save() print "Total patch %d" % pcount return 0