def process_push(json_data): info = json.loads(json_data) try: clone_url = info["repository"]["clone_url"] repository_name = info["repository"]["full_name"] ref = info["ref"] except IndexError: # Missing information in JSON, just ignore it return repo = Repository(repository_name) if not os.path.exists(os.path.join(config.REPOSITORY_PATH, repository_name)): repo.initialize() repo.setup_env() repo.pull(ref) repo.reset_env()
if not os.path.isdir(config.VIRTENV_PATH): os.makedirs(config.VIRTENV_PATH) #process_push(json.dumps({ "repository": { "clone_url": "https://github.com/yzzyx/photoshop.git", # "full_name": "yzzyx/photoshop", }, # "ref": "refs/heads/master" })) variable_list = { "git_clone_url": "https://github.com/yzzyx/photoshop.git", "git_repository_full_name": "yzzyx/photoshop", "date": strftime(config.DATETIME_STR, localtime()) } repo = Repository("yzzyx/photoshop") repo.set_clone_url("https://github.com/yzzyx/photoshop.git") repo.initialize() repo.setup_env() repo.fetch() branches = repo.get_branches() for b in branches: # Check if we already have this data if not b.cached_data: print "Not cached: %s %s" % (b.name, strftime(config.DATETIME_STR,localtime(b.last_updated))) (rv, total, failed, output) = handlers.handler.process_handlers() b.failed_tests = failed b.total_tests = total b.output_log = output b.save() else: print "Cached: %s %s" % (b.name, strftime(config.DATETIME_STR,localtime(b.last_updated)))