本文整理汇总了Python中datalad.support.gitrepo.GitRepo.get_remote_url方法的典型用法代码示例。如果您正苦于以下问题:Python GitRepo.get_remote_url方法的具体用法?Python GitRepo.get_remote_url怎么用?Python GitRepo.get_remote_url使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类datalad.support.gitrepo.GitRepo
的用法示例。
在下文中一共展示了GitRepo.get_remote_url方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_siblings
# 需要导入模块: from datalad.support.gitrepo import GitRepo [as 别名]
# 或者: from datalad.support.gitrepo.GitRepo import get_remote_url [as 别名]
def test_siblings(origin, repo_path):
sshurl = "ssh://push-remote.example.com"
httpurl1 = "http://remote1.example.com/location"
httpurl2 = "http://remote2.example.com/location"
# insufficient arguments
# we need a dataset to work at
with chpwd(repo_path): # not yet there
assert_raises(InsufficientArgumentsError,
siblings, 'add', url=httpurl1)
# prepare src
source = install(repo_path, source=origin, recursive=True)
# pollute config
depvar = 'remote.test-remote.datalad-publish-depends'
source.config.add(depvar, 'stupid', where='local')
# cannot configure unknown remotes as dependencies
res = siblings(
'configure',
dataset=source,
name="test-remote",
url=httpurl1,
publish_depends=['r1', 'r2'],
on_failure='ignore',
result_renderer=None)
assert_status('error', res)
eq_(res[0]['message'],
('unknown sibling(s) specified as publication dependency: %s',
set(('r1', 'r2'))))
# prior config was not changed by failed call above
eq_(source.config.get(depvar, None), 'stupid')
res = siblings('configure',
dataset=source, name="test-remote",
url=httpurl1,
result_xfm='paths',
result_renderer=None)
eq_(res, [source.path])
assert_in("test-remote", source.repo.get_remotes())
eq_(httpurl1,
source.repo.get_remote_url("test-remote"))
# reconfiguring doesn't change anything
siblings('configure', dataset=source, name="test-remote",
url=httpurl1,
result_renderer=None)
assert_in("test-remote", source.repo.get_remotes())
eq_(httpurl1,
source.repo.get_remote_url("test-remote"))
# re-adding doesn't work
res = siblings('add', dataset=source, name="test-remote",
url=httpurl1, on_failure='ignore',
result_renderer=None)
assert_status('error', res)
# only after removal
res = siblings('remove', dataset=source, name="test-remote",
result_renderer=None)
assert_status('ok', res)
assert_not_in("test-remote", source.repo.get_remotes())
res = siblings('add', dataset=source, name="test-remote",
url=httpurl1, on_failure='ignore',
result_renderer=None)
assert_status('ok', res)
# add to another remote automagically taking it from the url
# and being in the dataset directory
with chpwd(source.path):
res = siblings('add', url=httpurl2,
result_renderer=None)
assert_result_count(
res, 1,
name="remote2.example.com", type='sibling')
assert_in("remote2.example.com", source.repo.get_remotes())
# don't fail with conflicting url, when using force:
res = siblings('configure',
dataset=source, name="test-remote",
url=httpurl1 + "/elsewhere",
result_renderer=None)
assert_status('ok', res)
eq_(httpurl1 + "/elsewhere",
source.repo.get_remote_url("test-remote"))
# no longer a use case, I would need additional convincing that
# this is anyhow useful other then tripple checking other peoples
# errors. for an actual check use 'query'
# maybe it could be turned into a set of warnings when `configure`
# alters an existing setting, but then why call configure, if you
# want to keep the old values
#with assert_raises(RuntimeError) as cm:
# add_sibling(dataset=source, name="test-remote",
# url=httpurl1 + "/elsewhere")
#assert_in("""'test-remote' already exists with conflicting settings""",
# str(cm.exception))
## add a push url without force fails, since in a way the fetch url is the
## configured push url, too, in that case:
#with assert_raises(RuntimeError) as cm:
#.........这里部分代码省略.........