예제 #1
0
 async def test_ls_remote_forever(self):
     '''
     Test case for a repo which hangs for a long time to make sure we git
     ls-remote eventually.
     '''
     git = Git(self.tempdir)
     self.assertFalse(await git.ls_remote('git://java.net/jax-rs-spec~api'))
예제 #2
0
 async def test_infer_main_branch(self):
     gitdir = self.tempdir.mktempdir()
     subprocess.check_output(['git', 'init'], cwd=gitdir)
     with open(os.path.join(gitdir, 'README.md'), 'w') as handle:
         handle.write('# Hello World')
     subprocess.check_output(['git', 'add', '-A'], cwd=gitdir)
     subprocess.check_output(['git', 'checkout', '-b', 'v2'], cwd=gitdir)
     subprocess.check_output(['git', 'commit', '-m', 'Initial Commit'],
                             cwd=gitdir)
     for src_url, branch in [(self.gcreated, 'master'), (gitdir, 'v2')]:
         git = Git(self.tempdir)
         with self.subTest(src_url=src_url, branch=branch):
             self.assertTrue(await git.clone(src_url))
             self.assertEqual(git.main_branch, branch)
             shutil.rmtree(git.cwd, ignore_errors=True)
예제 #3
0
 async def test_ls_remote_svn(self):
     git = Git(self.tempdir)
     self.assertTrue(
         await
         git.ls_remote('https://svn.code.sf.net/p/lame/svn/trunk/lame'))
예제 #4
0
 async def test_ls_remote(self):
     git = Git(self.tempdir)
     self.assertTrue(await git.ls_remote(self.gcreated))
예제 #5
0
 async def test_ls_remote_no_repo(self):
     git = Git(self.tempdir)
     self.assertFalse(await git.ls_remote(str(random.random())))
예제 #6
0
 async def test_not_a_git_repo(self):
     git = Git(self.tempdir)
     self.assertFalse(await git.clone('https://example.com'))
     self.assertFalse(os.path.isdir(git.cwd))
예제 #7
0
 async def test_no_repo(self):
     git = Git(self.tempdir)
     self.assertFalse(await git.clone(str(random.random())))
     self.assertFalse(os.path.isdir(git.cwd))
예제 #8
0
 async def test_git_clone_svn(self):
     git = Git(self.tempdir)
     self.assertTrue(
         len(await
             git.clone('https://svn.code.sf.net/p/lame/svn/trunk/lame')))
     shutil.rmtree(git.cwd, ignore_errors=True)
예제 #9
0
 async def test_git_clone(self):
     git = Git(self.tempdir)
     self.assertTrue(await git.clone(self.gcreated))
     shutil.rmtree(git.cwd, ignore_errors=True)