예제 #1
0
 def test_git_update_with_submodules(
     self, fake_repo, local_folder_exists, *_
 ):
     git_clone(self.require_with_submodule)
     fake_repo.assert_called_with(self.expected_local_repo_path)
     repo = fake_repo.return_value
     repo.git.submodule.assert_called_with("update")
예제 #2
0
 def test_checkout_new(self, fake_repo, local_folder_exists, *_):
     local_folder_exists.side_effect = [fs.errors.CreateFailed]
     git_clone(self.require)
     fake_repo.clone_from.assert_called_with(
         self.repo,
         self.expected_local_repo_path,
         single_branch=True,
         depth=2,
     )
     repo = fake_repo.return_value
     eq_(repo.git.submodule.called, False)
예제 #3
0
    def test_update_failed_because_offline(
        self, fake_warn, fake_repo, local_folder_exists, *_
    ):
        from git.exc import GitCommandError

        repo = MagicMock(autospec=True)
        fake_repo.return_value = repo

        repo.git.pull.side_effect = [GitCommandError("a", "b")]
        git_clone(self.require_with_reference)

        fake_warn.assert_called_with("Unable to run git commands. Offline?")
예제 #4
0
파일: opener.py 프로젝트: mobanbot/gitfs2
 def open_fs(self, fs_url, parse_result, writeable, create, cwd):
     repo_name, _, dir_path = parse_result.resource.partition("/")
     git_url = "{protocol}://{resource}".format(
         protocol=parse_result.protocol, resource=parse_result.resource)
     require = repo.GitRequire(
         git_url=git_url,
         branch=parse_result.params.get("branch"),
         submodule=parse_result.params.get("submodule"),
         reference=parse_result.params.get("reference"),
     )
     local_folder = repo.git_clone(
         require,
         action_required=GitFSOpener.update_registry.get(git_url, True))
     if GitFSOpener.update_registry.get(git_url, True):
         GitFSOpener.update_registry[git_url] = False
     if parse_result.path:
         local_folder = local_folder + parse_result.path
     osfs = OSFS(root_path=local_folder)
     return osfs
예제 #5
0
def test_clone_a_real_github():
    git_url = "https://github.com/moremoban/hello"
    require = GitRequire(git_url=git_url)
    folder = git_clone(require)
    fs.open_fs(folder)
예제 #6
0
 def test_update_existing_with_branch_parameter(
     self, fake_repo, local_folder_exists, *_
 ):
     git_clone(self.require_with_branch)
     repo = fake_repo.return_value
     repo.git.checkout.assert_called_with("ghpages")
예제 #7
0
 def test_git_update(self, fake_repo, local_folder_exists, *_):
     git_clone(self.require)
     fake_repo.assert_called_with(self.expected_local_repo_path)
     repo = fake_repo.return_value
     repo.git.pull.assert_called()
예제 #8
0
 def test_update_existing_with_reference_parameter(
     self, fake_repo, local_folder_exists, *_
 ):
     git_clone(self.require_with_reference)
     repo = fake_repo.return_value
     repo.git.checkout.assert_called_with("a-commit-reference")