def test_create_git_repo(self): git_path = os.path.join(get_repo_root(), "abc.git") CodeDoubanProject.create_git_repo(git_path) assert os.path.exists(git_path) info_file = os.path.join(git_path, "refs") assert os.path.exists(info_file) shutil.rmtree(git_path)
def test_create_git_repo(self): git_path = os.path.join(get_repo_root(), 'abc.git') CodeDoubanProject.create_git_repo(git_path) assert os.path.exists(git_path) info_file = os.path.join(git_path, 'refs') assert os.path.exists(info_file) shutil.rmtree(git_path)
def test_create(self): git_path = os.path.join(get_repo_root(), 'test_create.git') assert not os.path.exists( git_path), "git_path should not exist prior repo creation" CodeDoubanProject.create_git_repo(git_path) assert os.path.exists( git_path), "create_git_repo should create git_path" refs_file = os.path.join(git_path, 'refs') assert os.path.exists(refs_file), \ "create_git_repo should create a git repo with refs subdir"
def _repo(self, name, bare=True): git_path = self._path(name) if bare: work_tree_path = None else: work_tree_path = self._path_work_tree(name) os.mkdir(work_tree_path) CodeDoubanProject.create_git_repo(git_path) repo = git.GitRepo(git_path, work_tree=work_tree_path) return repo
def _repo(self, name, bare=True): git_path = self._path(name) if bare: work_tree_path = None else: work_tree_path = self._path_work_tree(name) os.mkdir(work_tree_path) try: CodeDoubanProject.create_git_repo(git_path) except: pass repo = git.GitRepo(git_path, work_tree=work_tree_path) return repo
def _repo(self, name, bare=True): git_path = self._path(name) if bare: work_tree_path = None else: work_tree_path = self._path_work_tree(name) if not os.path.exists(work_tree_path): os.mkdir(work_tree_path) try: CodeDoubanProject.create_git_repo(git_path) except: pass repo = git.GitRepo(git_path, work_tree=work_tree_path) return repo
def _repo(self, name, bare=True): git_path = self._path(name) if bare: work_tree_path = None else: work_tree_path = self._path_work_tree(name) if os.path.exists(git_path): shutil.rmtree(git_path, ignore_errors=True) try: os.mkdir(work_tree_path) except OSError: pass CodeDoubanProject.create_git_repo(git_path) repo = git.GitRepo(git_path, work_tree=work_tree_path) return repo
def test_gitrepo_path(self): git_path = self._path('test_gitrepo_path') CodeDoubanProject.create_git_repo(git_path) repo = git.GitRepo(git_path) assert repo.path == git_path, "repo.path should be equal to git_path"