def __init__(self, repo_config, repo_branch_name): self.config = get_config() self.repo_branch_name = repo_branch_name self.repo_config = repo_config self.max_buffer_size = self.config.get('batchSize', 20) self.buffer = [] self.es_client = _get_es_client(self.config)
def create_index(): config = get_config() es = _get_es_client(config) es.indices.create(_get_commit_index(config), body=get_es_index_config())
from git import Repo from repo_index.index import CommitSyncer from repo_scan.cache import CacheManager from repo_scan.config import get_config from repo_scan.repo_utils import get_matching_repo_branches config = get_config() def _read_commits_from_repository(repo_config): repo = Repo(path=repo_config['repoPath']) if repo.bare: print("'%s' is not a valid Git repository" % repo_config['repoPath']) return _pull_from_remote(repo, repo_config) matching_branches_for_repo = get_matching_repo_branches(repo_config['branches'], repo.branches) if not matching_branches_for_repo: print("No matching branches found in repository '%s'" % repo_config['friendlyName']) for branch_name in matching_branches_for_repo: print("Commits in branch: %s" % branch_name) cache_manager = CacheManager(config['cachePath'], repo_config, branch_name) commit_syncer = CommitSyncer(repo_config, branch_name) latest_commit_sha = None for index, commit in enumerate(repo.iter_commits(branch_name)):