def __init__(self,repo_url,repo_name,repo_lang): self.repo_url = repo_url self.repo_name = repo_name print(self.repo_name) self.repo_lang = repo_lang self.repo_obj = git2repo.git2repo(self.repo_url,self.repo_name) self.repo = self.repo_obj.clone_repo() if platform.system() == 'Darwin' or platform.system() == 'Linux': self.repo_path = up(os.getcwd()) + '/temp_repo/' + self.repo_name self.file_path = up(os.getcwd()) + '/data/' + self.repo_name + '_commit.pkl' self.committed_file = up(os.getcwd()) + '/data/' + self.repo_name + '_committed_file.pkl' else: self.repo_path = up(os.getcwd()) + '\\temp_repo\\' + self.repo_name self.file_path = up(os.getcwd()) + '\\data\\' + self.repo_name + '_commit.pkl' self.committed_file = up(os.getcwd()) + '\\data\\' + self.repo_name + '_committed_file.pkl' self.buggy_clean_pairs = self.read_commits() self.repo_path = self.repo_obj.repo_path # Reference current directory, so we can go back after we are done. self.cwd = Path(os.getcwd()) # Generate path to store udb files self.udb_path = self.cwd.joinpath(".temp", "udb") # Create a folder to hold the udb files if not self.udb_path.is_dir(): os.makedirs(self.udb_path) # Generate source path where the source file exist self.source_path = self.cwd.joinpath( ".temp", "sources", self.repo_name)
def __init__(self,access_token,repo_owner,source_type,git_url,api_base_url,repo_name): self.repo_name = repo_name if platform.system() == 'Darwin' or platform.system() == 'Linux': self.data_path = up(os.getcwd()) + '/data/' else: self.data_path = up(os.getcwd()) + '\\data\\' self.git_client = api_access.git_api_access(access_token,repo_owner,source_type,git_url,api_base_url,repo_name) self.git_repo = git2repo.git2repo(git_url,repo_name) self.repo = self.git_repo.clone_repo()
def __init__(self, repo_url, repo_name): self.repo_url = repo_url self.repo_name = repo_name self.repo_obj = git2repo.git2repo(self.repo_url, self.repo_name) self.repo = self.repo_obj.clone_repo() if platform.system() == 'Darwin' or platform.system() == 'Linux': self.repo_path = up(os.getcwd()) + '/temp_repo/' + repo_name self.file_path = up( os.getcwd()) + '/data/' + repo_name + '_commit.pkl' else: self.repo_path = up(os.getcwd()) + '\\temp_repo\\' + repo_name self.file_path = up( os.getcwd()) + '\\data\\' + repo_name + '_commit.pkl' self.commits = self.read_commits() self.commit_df = pd.DataFrame(self.commits, columns=['commit_object']) self.diffs = self.get_diffs() print('diffs done') self.cores = cpu_count()
def initilize_repo(self, repo_url, repo_name): self.git_repo = git2repo.git2repo(repo_url, repo_name) self.repo = self.git_repo.clone_repo()