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()
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))) repo.reset_env() t = template.Template(config.TEMPLATE_FILE) t.set_variables(variable_list) for b in branches: t.add_branch(b.__dict__) print t.parse()