示例#1
0
 def test_create_no_folder(self):
     with TempDir() as tmp:
         repo_path = tmp / 'no-folder'
         repo = GitHubRepo.create(repo_path, mk_dir=True)
         git_dir = repo_path / '.git'
         ok_(git_dir.exists())
         eq_(str(git_dir), repo.path)
示例#2
0
 def test_create_no_folder(self):
     with TempDir() as tmp:
         repo_path = tmp / 'no-folder'
         repo = GitHubRepo.create(repo_path, mk_dir=True)
         git_dir = repo_path / '.git'
         ok_(git_dir.exists())
         eq_(str(git_dir), repo.path)
示例#3
0
    def test_init(self):
        with TempDir() as tmp:
            remote_path = tmp / 'remote-repo'
            remote_repo = Repo.create(remote_path, mk_dir=True)
            with open(remote_path / 'test.txt', 'w') as f:
                f.write('testing...')
            remote_repo.git.add('test.txt')
            remote_repo.git.commit('-m', 'testing...')

            # set a local repository and add the module
            local_path = tmp / 'local-repo'
            local_repo = Repo.create(local_path, mk_dir=True)
            module = Submodule(local_repo, 'file://%s' % remote_path, 'test')
            module.init('testing')
            ok_(os.path.exists(local_path / 'test/.git'))
            ok_(os.path.exists(local_path / 'test/test.txt'))
            ok_(os.path.exists(local_path / '.gitmodules'))
示例#4
0
 def test_init(self):
     with TempDir() as tmp:
         remote_path = tmp / 'remote-repo'
         remote_repo = Repo.create(remote_path, mk_dir=True)
         with open(remote_path / 'test.txt', 'w') as f:
             f.write('testing...')
         remote_repo.git.add('test.txt')
         remote_repo.git.commit('-m', 'testing...')
         
         # set a local repository and add the module
         local_path = tmp / 'local-repo'
         local_repo = Repo.create(local_path, mk_dir=True)
         module = Submodule(local_repo,
             'file://%s' % remote_path, 'test')
         module.init('testing')
         ok_(os.path.exists(local_path / 'test/.git'))
         ok_(os.path.exists(local_path / 'test/test.txt'))
         ok_(os.path.exists(local_path / '.gitmodules'))
示例#5
0
 def test_add(self):
     with TempDir() as tmp:
         # set a remote repository
         remote_path = tmp / 'remote-repo'
         remote_repo = Repo.create(remote_path, mk_dir=True)
         with open(remote_path / 'test.txt', 'w') as f:
             f.write('testing...')
         remote_repo.git.add('test.txt')
         remote_repo.git.commit('-m', 'testing...')
         
         # set a local repository and add the module
         local_path = tmp / 'local-repo'
         local_repo = Repo.create(local_path, mk_dir=True)
         eq_(0, len(local_repo.submodules))
         local_repo.submodules.add('file://%s' % remote_path, 'test')
         ok_(os.path.exists(local_path / 'test/.git'))
         ok_(os.path.exists(local_path / 'test/test.txt'))
         ok_(os.path.exists(local_path / '.gitmodules'))
         eq_(1, len(local_repo.submodules))
         eq_('file://%s' % remote_path, local_repo.submodules['test'].url)
示例#6
0
    def test_add(self):
        with TempDir() as tmp:
            # set a remote repository
            remote_path = tmp / 'remote-repo'
            remote_repo = Repo.create(remote_path, mk_dir=True)
            with open(remote_path / 'test.txt', 'w') as f:
                f.write('testing...')
            remote_repo.git.add('test.txt')
            remote_repo.git.commit('-m', 'testing...')

            # set a local repository and add the module
            local_path = tmp / 'local-repo'
            local_repo = Repo.create(local_path, mk_dir=True)
            eq_(0, len(local_repo.submodules))
            local_repo.submodules.add('file://%s' % remote_path, 'test')
            ok_(os.path.exists(local_path / 'test/.git'))
            ok_(os.path.exists(local_path / 'test/test.txt'))
            ok_(os.path.exists(local_path / '.gitmodules'))
            eq_(1, len(local_repo.submodules))
            eq_('file://%s' % remote_path, local_repo.submodules['test'].url)
示例#7
0
 def test_create(self):
     with TempDir() as tmp:
         repo = GitHubRepo.create(tmp)
         git_dir = tmp / '.git'
         ok_(git_dir.exists())
         eq_(str(git_dir), repo.path)
示例#8
0
 def test_create(self):
     with TempDir() as tmp:
         repo = GitHubRepo.create(tmp)
         git_dir = tmp / '.git'
         ok_(git_dir.exists())
         eq_(str(git_dir), repo.path)