def is_index_empty(self): """ Returns `True` if index directory is empty and `False` otherwise """ if len(ls_dir([self.index_path])): return False return True
def archive_dir(zip_path, dir_path): zip_file = zipfile.ZipFile(zip_path, 'w') with zip_file: # Writing each file one by one for file in ls_dir([dir_path]): zip_file.write(file, file[len(dir_path):]) # Remove model directory shutil.rmtree(dir_path)
def ls_commit_files(self, branch, commit): """ Returns list of files of the specified commit """ commit_path = os.path.join(self.path, branch, commit) return ls_dir([commit_path])
def ls_branch_files(self, branch): """ Returns list of files of the specified branch """ branch_path = os.path.join(self.path, branch) return ls_dir([branch_path])
def ls_files(self): """ Returns list of repository files """ return ls_dir([self.path])