本文整理汇总了Python中datalad.support.gitrepo.GitRepo.fetch方法的典型用法代码示例。如果您正苦于以下问题:Python GitRepo.fetch方法的具体用法?Python GitRepo.fetch怎么用?Python GitRepo.fetch使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类datalad.support.gitrepo.GitRepo
的用法示例。
在下文中一共展示了GitRepo.fetch方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_GitRepo_ssh_fetch
# 需要导入模块: from datalad.support.gitrepo import GitRepo [as 别名]
# 或者: from datalad.support.gitrepo.GitRepo import fetch [as 别名]
def test_GitRepo_ssh_fetch(remote_path, repo_path):
from datalad import ssh_manager
remote_repo = GitRepo(remote_path, create=False)
url = "ssh://localhost" + op.abspath(remote_path)
socket_path = op.join(ssh_manager.socket_dir, get_connection_hash('localhost'))
repo = GitRepo(repo_path, create=True)
repo.add_remote("ssh-remote", url)
# we don't know any branches of the remote:
eq_([], repo.get_remote_branches())
fetched = repo.fetch(remote="ssh-remote")
assert_in('ssh-remote/master', [commit.name for commit in fetched])
ok_clean_git(repo)
# the connection is known to the SSH manager, since fetch() requested it:
assert_in(socket_path, ssh_manager._connections)
# and socket was created:
ok_(op.exists(socket_path))
# we actually fetched it:
assert_in('ssh-remote/master', repo.get_remote_branches())