def setUp(self): # Path where to clone remote repo for tests self.git_base_repo_path = os.path.join( settings.DATA_DIR, 'test-base-repo.git' ) # Repository on which tests will be performed self.git_repo_path = os.path.join( settings.DATA_DIR, 'test-repo.git' ) # Path where to clone remote repo for tests self.hg_base_repo_path = os.path.join( settings.DATA_DIR, 'test-base-repo.hg' ) # Repository on which tests will be performed self.hg_repo_path = os.path.join( settings.DATA_DIR, 'test-repo.hg' ) # Clone repo for testing if not os.path.exists(self.git_base_repo_path): GitRepository.clone( GIT_URL, self.git_base_repo_path, bare=True ) # Remove possibly existing directory if os.path.exists(self.git_repo_path): shutil.rmtree(self.git_repo_path) # Create repository copy for the test shutil.copytree(self.git_base_repo_path, self.git_repo_path) # Clone repo for testing if not os.path.exists(self.hg_base_repo_path): HgRepository.clone( HG_URL, self.hg_base_repo_path, bare=True ) # Remove possibly existing directory if os.path.exists(self.hg_repo_path): shutil.rmtree(self.hg_repo_path) # Create repository copy for the test shutil.copytree(self.hg_base_repo_path, self.hg_repo_path) # Remove possibly existing project directory test_repo_path = os.path.join(settings.DATA_DIR, 'vcs', 'test') if os.path.exists(test_repo_path): shutil.rmtree(test_repo_path)
def setUp(self): # Path where to clone remote repo for tests self.git_base_repo_path = os.path.join(settings.DATA_DIR, 'test-base-repo.git') # Repository on which tests will be performed self.git_repo_path = os.path.join(settings.DATA_DIR, 'test-repo.git') # Path where to clone remote repo for tests self.hg_base_repo_path = os.path.join(settings.DATA_DIR, 'test-base-repo.hg') # Repository on which tests will be performed self.hg_repo_path = os.path.join(settings.DATA_DIR, 'test-repo.hg') # Clone repo for testing if not os.path.exists(self.git_base_repo_path): print('Cloning Git test repository to {0}...'.format( self.git_base_repo_path)) GitRepository.clone(GIT_URL, self.git_base_repo_path, bare=True) # Remove possibly existing directory if os.path.exists(self.git_repo_path): shutil.rmtree(self.git_repo_path) # Create repository copy for the test shutil.copytree(self.git_base_repo_path, self.git_repo_path) if HgRepository.is_supported(): # Clone repo for testing if not os.path.exists(self.hg_base_repo_path): print('Cloning Mercurial test repository to {0}...'.format( self.hg_base_repo_path)) HgRepository.clone(HG_URL, self.hg_base_repo_path, bare=True) # Remove possibly existing directory if os.path.exists(self.hg_repo_path): shutil.rmtree(self.hg_repo_path) # Create repository copy for the test shutil.copytree(self.hg_base_repo_path, self.hg_repo_path) # Remove possibly existing project directory test_repo_path = os.path.join(settings.DATA_DIR, 'vcs', 'test') if os.path.exists(test_repo_path): shutil.rmtree(test_repo_path) # Remove indexes clean_indexes()
def setUp(self): if 'test-repos' in settings.GIT_ROOT: test_dir = os.path.join(settings.GIT_ROOT, 'test') if os.path.exists(test_dir): shutil.rmtree(test_dir) # Path where to clone remote repo for tests self.git_base_repo_path = os.path.join(settings.GIT_ROOT, 'test-base-repo.git') # Repository on which tests will be performed self.git_repo_path = os.path.join(settings.GIT_ROOT, 'test-repo.git') # Path where to clone remote repo for tests self.hg_base_repo_path = os.path.join(settings.GIT_ROOT, 'test-base-repo.hg') # Repository on which tests will be performed self.hg_repo_path = os.path.join(settings.GIT_ROOT, 'test-repo.hg') # Clone repo for testing if not os.path.exists(self.git_base_repo_path): GitRepository.clone(GIT_URL, self.git_base_repo_path, bare=True) # Remove possibly existing directory if os.path.exists(self.git_repo_path): shutil.rmtree(self.git_repo_path) # Create repository copy for the test shutil.copytree(self.git_base_repo_path, self.git_repo_path) # Clone repo for testing if not os.path.exists(self.hg_base_repo_path): HgRepository.clone(HG_URL, self.hg_base_repo_path, bare=True) # Remove possibly existing directory if os.path.exists(self.hg_repo_path): shutil.rmtree(self.hg_repo_path) # Create repository copy for the test shutil.copytree(self.hg_base_repo_path, self.hg_repo_path) # Remove possibly existing project directory test_repo_path = os.path.join(settings.GIT_ROOT, 'test') if os.path.exists(test_repo_path): shutil.rmtree(test_repo_path)
def setUp(self): # Path where to clone remote repo for tests self.git_base_repo_path = os.path.join(settings.DATA_DIR, "test-base-repo.git") # Repository on which tests will be performed self.git_repo_path = os.path.join(settings.DATA_DIR, "test-repo.git") # Path where to clone remote repo for tests self.hg_base_repo_path = os.path.join(settings.DATA_DIR, "test-base-repo.hg") # Repository on which tests will be performed self.hg_repo_path = os.path.join(settings.DATA_DIR, "test-repo.hg") # Clone repo for testing if not os.path.exists(self.git_base_repo_path): print("Cloning Git test repository to {0}...".format(self.git_base_repo_path)) GitRepository.clone(GIT_URL, self.git_base_repo_path, bare=True) # Remove possibly existing directory if os.path.exists(self.git_repo_path): shutil.rmtree(self.git_repo_path) # Create repository copy for the test shutil.copytree(self.git_base_repo_path, self.git_repo_path) # Clone repo for testing if not os.path.exists(self.hg_base_repo_path): print("Cloning Mercurial test repository to {0}...".format(self.hg_base_repo_path)) HgRepository.clone(HG_URL, self.hg_base_repo_path, bare=True) # Remove possibly existing directory if os.path.exists(self.hg_repo_path): shutil.rmtree(self.hg_repo_path) # Create repository copy for the test shutil.copytree(self.hg_base_repo_path, self.hg_repo_path) # Remove possibly existing project directory test_repo_path = os.path.join(settings.DATA_DIR, "vcs", "test") if os.path.exists(test_repo_path): shutil.rmtree(test_repo_path) # Remove indexes clean_indexes()
def checkout_tmp(self, project, repo, branch): ''' Checkouts project to temporary location. ''' # Create temporary working dir workdir = tempfile.mkdtemp(dir=project.get_path()) os.chmod(workdir, 0o755) # Initialize git repository self.logger.info('Cloning git repository...') gitrepo = GitRepository.clone(repo, workdir) self.logger.info('Updating working copy in git repository...') gitrepo.configure_branch(branch) return workdir
def setUp(self): if 'test-repos' in settings.GIT_ROOT: test_dir = os.path.join(settings.GIT_ROOT, 'test') if os.path.exists(test_dir): shutil.rmtree(test_dir) # Path where to clone remote repo for tests self.base_repo_path = os.path.join( settings.GIT_ROOT, 'test-base-repo.git' ) # Repository on which tests will be performed self.repo_path = os.path.join( settings.GIT_ROOT, 'test-repo.git' ) # Clone repo for testing if not os.path.exists(self.base_repo_path): GitRepository.clone( GIT_URL, self.base_repo_path, bare=True ) # Remove possibly existing directory if os.path.exists(self.repo_path): shutil.rmtree(self.repo_path) # Create repository copy for the test shutil.copytree(self.base_repo_path, self.repo_path) # Remove possibly existing project directory test_repo_path = os.path.join(settings.GIT_ROOT, 'test') if os.path.exists(test_repo_path): shutil.rmtree(test_repo_path)
def test_revision(self): repo = GitRepository.clone(self.repo_path, self._tempdir) self.assertEquals( repo.last_revision, repo.last_remote_revision )
def test_push(self): repo = GitRepository.clone(self.repo_path, self._tempdir) repo.push('master')
def test_needs_commit(self): repo = GitRepository.clone(self.repo_path, self._tempdir) self.assertFalse(repo.needs_commit())
def test_status(self): repo = GitRepository.clone(self.repo_path, self._tempdir) status = repo.status() self.assertTrue( "Your branch is up-to-date with 'origin/master'." in status)
def test_rebase(self): repo = GitRepository.clone(self.repo_path, self._tempdir) repo.rebase('master')
def test_update_remote(self): repo = GitRepository.clone(self.repo_path, self._tempdir) repo.update_remote()
def test_revision(self): repo = GitRepository.clone(self.repo_path, self._tempdir) self.assertEquals(repo.last_revision, repo.last_remote_revision)
def test_clone(self): GitRepository.clone(self.repo_path, self._tempdir)
def setUp(self): super(VCSGitTest, self).setUp() self._tempdir = tempfile.mkdtemp() self.repo = GitRepository.clone(self.repo_path, self._tempdir)
def test_status(self): repo = GitRepository.clone(self.repo_path, self._tempdir) status = repo.status() self.assertTrue( "Your branch is up-to-date with 'origin/master'." in status )