本文整理汇总了Python中qisrc.git_config.Remote.name方法的典型用法代码示例。如果您正苦于以下问题:Python Remote.name方法的具体用法?Python Remote.name怎么用?Python Remote.name使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类qisrc.git_config.Remote
的用法示例。
在下文中一共展示了Remote.name方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_warn_on_default_change
# 需要导入模块: from qisrc.git_config import Remote [as 别名]
# 或者: from qisrc.git_config.Remote import name [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_git_configs_are_persistent
# 需要导入模块: from qisrc.git_config import Remote [as 别名]
# 或者: from qisrc.git_config.Remote import name [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)
示例3: test_warn_on_remote_change
# 需要导入模块: from qisrc.git_config import Remote [as 别名]
# 或者: from qisrc.git_config.Remote import name [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")
示例4: test_apply_remote_config
# 需要导入模块: from qisrc.git_config import Remote [as 别名]
# 或者: from qisrc.git_config.Remote import name [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
示例5: test_apply_git_config
# 需要导入模块: from qisrc.git_config import Remote [as 别名]
# 或者: from qisrc.git_config.Remote import name [as 别名]
def test_apply_git_config(git_worktree):
""" Test Appli Git Config """
foo1 = git_worktree.create_git_project("foo")
upstream = Remote()
upstream.name = "upstream"
upstream.url = "[email protected]:bar.git"
foo1.configure_remote(upstream)
foo1.apply_config()
git = qisrc.git.Git(foo1.path)
assert git.get_config("remote.upstream.url") == "[email protected]:bar.git"
foo1.configure_branch("master", tracks="upstream")
foo1.apply_config()
assert git.get_tracking_branch("master") == "upstream/master"
foo1.configure_branch(
"feature", tracks="upstream",
remote_branch="remote_branch"
)
foo1.apply_config()
assert git.get_tracking_branch("feature") == "upstream/remote_branch"