本文整理汇总了Python中qisrc.git_config.Remote.default方法的典型用法代码示例。如果您正苦于以下问题:Python Remote.default方法的具体用法?Python Remote.default怎么用?Python Remote.default使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类qisrc.git_config.Remote
的用法示例。
在下文中一共展示了Remote.default方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_warn_on_default_change
# 需要导入模块: from qisrc.git_config import Remote [as 别名]
# 或者: from qisrc.git_config.Remote import default [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_apply_remote_config
# 需要导入模块: from qisrc.git_config import Remote [as 别名]
# 或者: from qisrc.git_config.Remote import default [as 别名]
def test_apply_remote_config(git_worktree):
foo = git_worktree.create_git_project("foo")
origin = Remote()
origin.name = "origin"
origin.url = "[email protected]:foo.git"
origin.default = True
gerrit = Remote()
gerrit.name = "gerrit"
gerrit.url = "[email protected]:foo.git"
gerrit.review = True
foo_repo = RepoConfig()
foo_repo.remotes = [origin, gerrit]
foo_repo.default_branch = "master"
foo.apply_remote_config(foo_repo)
foo.save_config()
assert foo_repo.default_remote == origin
assert foo.review_remote == gerrit
# Check its persistent:
git_worktree = TestGitWorkTree()
foo2 = git_worktree.get_git_project("foo")
assert foo2.default_remote == origin
assert foo2.review_remote == gerrit