本文整理汇总了Python中qisrc.git_config.Remote.url方法的典型用法代码示例。如果您正苦于以下问题:Python Remote.url方法的具体用法?Python Remote.url怎么用?Python Remote.url使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类qisrc.git_config.Remote
的用法示例。
在下文中一共展示了Remote.url方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_warn_on_default_change
# 需要导入模块: from qisrc.git_config import Remote [as 别名]
# 或者: from qisrc.git_config.Remote import url [as 别名]
def test_warn_on_default_change(git_worktree, record_messages):
""" Test Warn on Default Change """
foo1 = git_worktree.create_git_project("foo")
gitorious = Remote()
gitorious.name = "gitorious"
gitorious.url = "[email protected]:libfoo/libfoo.git"
gitorious.default = True
gitlab = Remote()
gitlab.name = "gitlab"
gitlab.url = "[email protected]:foo/libfoo.git"
foo_repo = RepoConfig()
foo_repo.default_branch = "master"
foo_repo.remotes = [gitlab, gitorious]
foo1.read_remote_config(foo_repo)
foo1.apply_config()
assert foo1.default_remote.name == "gitorious"
gitorious2 = copy.copy(gitorious)
gitorious2.default = False
gitlab2 = copy.copy(gitlab)
gitlab2.default = True
record_messages.reset()
foo_repo = RepoConfig()
foo_repo.remotes = [gitlab2, gitorious2]
foo_repo.default_branch = "master"
foo1.read_remote_config(foo_repo)
foo1.apply_config()
assert record_messages.find("Default remote changed")
assert foo1.default_remote.name == "gitlab"
示例2: test_gerrit_url_ssh_subfolder
# 需要导入模块: from qisrc.git_config import Remote [as 别名]
# 或者: from qisrc.git_config.Remote import url [as 别名]
def test_gerrit_url_ssh_subfolder():
with mock.patch("qisrc.review.get_gerrit_username") as get_username:
get_username.return_value = "john"
remote = Remote()
remote.url = "ssh://review.corp:29418/a/subfolder"
remote.parse_url()
assert remote.prefix == "ssh://[email protected]:29418/a/subfolder/"
assert remote.port == 29418
remote.url = "ssh://review.corp:29418/a/subfolder/"
remote.parse_url()
assert remote.prefix == "ssh://[email protected]:29418/a/subfolder/"
示例3: test_git_configs_are_persistent
# 需要导入模块: from qisrc.git_config import Remote [as 别名]
# 或者: from qisrc.git_config.Remote import url [as 别名]
def test_git_configs_are_persistent(git_worktree):
""" Test Git Config Are Persistent """
foo1 = git_worktree.create_git_project("foo")
upstream = Remote()
upstream.name = "upstream"
upstream.url = "[email protected]:bar.git"
foo1.configure_remote(upstream)
foo1.configure_branch("master", tracks="upstream")
foo1.save_config()
def check_config(foo_check):
""" Check Condfig """
assert len(foo_check.remotes) == 1
upstream = foo_check.remotes[0]
assert upstream.name == "upstream"
assert upstream.url == "[email protected]:bar.git"
assert len(foo_check.branches) == 1
master = foo_check.branches[0]
assert master.name == "master"
assert master.tracks == "upstream"
check_config(foo1)
wt2 = qisrc.worktree.GitWorkTree(git_worktree.worktree)
foo2 = wt2.get_git_project("foo")
check_config(foo2)
示例4: test_url_ssh_with_username_with_subfolder
# 需要导入模块: from qisrc.git_config import Remote [as 别名]
# 或者: from qisrc.git_config.Remote import url [as 别名]
def test_url_ssh_with_username_with_subfolder():
remote = Remote()
remote.url = "ssh://[email protected]/bar/baz"
remote.parse_url()
assert remote.prefix == "ssh://[email protected]/bar/baz/"
assert remote.server == "foo"
assert remote.username == "git"
示例5: test_url_filepath
# 需要导入模块: from qisrc.git_config import Remote [as 别名]
# 或者: from qisrc.git_config.Remote import url [as 别名]
def test_url_filepath():
""" Test Url FilePath """
remote = Remote()
remote.url = "file:///path/to/dir"
remote.parse_url()
assert remote.prefix == "file:///path/to/dir/"
assert remote.protocol == "file"
示例6: test_existing_path
# 需要导入模块: from qisrc.git_config import Remote [as 别名]
# 或者: from qisrc.git_config.Remote import url [as 别名]
def test_existing_path(tmpdir):
""" Test Existing Path """
remote = Remote()
url = tmpdir.mkdir("srv").strpath
remote.url = url
remote.parse_url()
assert remote.prefix == url + os.path.sep
示例7: test_url_ssh_with_username_no_subfolder
# 需要导入模块: from qisrc.git_config import Remote [as 别名]
# 或者: from qisrc.git_config.Remote import url [as 别名]
def test_url_ssh_with_username_no_subfolder():
""" Test Url Ssh With Username No SubFolder """
remote = Remote()
remote.url = "ssh://[email protected]/"
remote.parse_url()
assert remote.prefix == "ssh://[email protected]/"
assert remote.username == "git"
示例8: test_url_git
# 需要导入模块: from qisrc.git_config import Remote [as 别名]
# 或者: from qisrc.git_config.Remote import url [as 别名]
def test_url_git():
remote = Remote()
remote.url = "git://example.com"
remote.parse_url()
assert remote.prefix == "git://example.com/"
assert remote.protocol == "git"
assert remote.server == "example.com"
示例9: test_ssh_url
# 需要导入模块: from qisrc.git_config import Remote [as 别名]
# 或者: from qisrc.git_config.Remote import url [as 别名]
def test_ssh_url():
remote = Remote()
remote.url = "[email protected]"
remote.parse_url()
assert remote.prefix == "[email protected]:"
assert remote.server == "example.com"
assert remote.protocol == "ssh"
assert not remote.port
示例10: test_url_https_trailing_slash
# 需要导入模块: from qisrc.git_config import Remote [as 别名]
# 或者: from qisrc.git_config.Remote import url [as 别名]
def test_url_https_trailing_slash():
remote = Remote()
remote.url = "https://review.corp/"
remote.parse_url()
assert remote.prefix == "https://review.corp/"
assert remote.server == "review.corp"
assert remote.protocol == "https"
assert not remote.port
示例11: test_url_http
# 需要导入模块: from qisrc.git_config import Remote [as 别名]
# 或者: from qisrc.git_config.Remote import url [as 别名]
def test_url_http():
remote = Remote()
remote.url = "http://review.corp:8080"
remote.parse_url()
assert remote.prefix == "http://review.corp:8080/"
assert remote.server == "review.corp"
assert remote.port == 8080
assert remote.protocol == "http"
示例12: test_url_win_filepath
# 需要导入模块: from qisrc.git_config import Remote [as 别名]
# 或者: from qisrc.git_config.Remote import url [as 别名]
def test_url_win_filepath():
if not os.name == "nt":
return
remote = Remote()
remote.url = r"file:///c:\path\to\foo"
remote.parse_url()
assert remote.prefix == r"file:///c:\path\to\foo" + "\\"
assert remote.protocol == "file"
示例13: test_url_win_filepath
# 需要导入模块: from qisrc.git_config import Remote [as 别名]
# 或者: from qisrc.git_config.Remote import url [as 别名]
def test_url_win_filepath():
""" Test Url Win FilePath """
if not os.name == 'nt':
return
remote = Remote()
remote.url = r"file:///c:\path\to\foo"
remote.parse_url()
assert remote.prefix == r"file:///c:\path\to\foo" + "\\"
assert remote.protocol == "file"
示例14: test_url_ssh_no_username
# 需要导入模块: from qisrc.git_config import Remote [as 别名]
# 或者: from qisrc.git_config.Remote import url [as 别名]
def test_url_ssh_no_username():
with mock.patch("qisrc.review.get_gerrit_username") as get_username:
get_username.return_value = "john"
remote = Remote()
remote.url = "ssh://review.corp:29418"
remote.parse_url()
assert remote.prefix == "ssh://[email protected]:29418/"
assert remote.server == "review.corp"
assert remote.port == 29418
assert remote.protocol == "ssh"
assert remote.username == "john"
示例15: test_warn_on_remote_change
# 需要导入模块: from qisrc.git_config import Remote [as 别名]
# 或者: from qisrc.git_config.Remote import url [as 别名]
def test_warn_on_remote_change(git_worktree, record_messages):
foo = git_worktree.create_git_project("foo")
origin = Remote()
origin.name = "origin"
origin.url = "[email protected]:foo.git"
foo.configure_remote(origin)
foo.configure_branch("master", tracks="origin", default=True)
origin2 = Remote()
origin2.name = "origin"
origin2.url = "[email protected]:libfoo.git"
foo.configure_remote(origin2)
assert record_messages.find("remote url changed")
foo.configure_branch("next", default=True)
assert record_messages.find("default branch changed")
gerrit = Remote()
gerrit.name = "gerrit"
gerrit.url = "http://gerrit/libfoo.git"
foo.configure_remote(gerrit)
foo.configure_branch("next", tracks="gerrit")
assert record_messages.find("now tracks gerrit instead")