当前位置: 首页>>代码示例>>Python>>正文


Python git_config.Remote类代码示例

本文整理汇总了Python中qisrc.git_config.Remote的典型用法代码示例。如果您正苦于以下问题:Python Remote类的具体用法?Python Remote怎么用?Python Remote使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Remote类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_git_configs_are_persistent

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)
开发者ID:aldebaran,项目名称:qibuild,代码行数:25,代码来源:test_git_worktree.py

示例2: test_url_ssh_with_username_with_subfolder

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"
开发者ID:alkino,项目名称:qibuild,代码行数:7,代码来源:test_git_config.py

示例3: test_url_filepath

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"
开发者ID:aldebaran,项目名称:qibuild,代码行数:7,代码来源:test_git_config.py

示例4: test_existing_path

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
开发者ID:aldebaran,项目名称:qibuild,代码行数:7,代码来源:test_git_config.py

示例5: test_url_ssh_with_username_no_subfolder

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"
开发者ID:aldebaran,项目名称:qibuild,代码行数:7,代码来源:test_git_config.py

示例6: test_url_git

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"
开发者ID:alkino,项目名称:qibuild,代码行数:7,代码来源:test_git_config.py

示例7: test_ssh_url

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
开发者ID:alkino,项目名称:qibuild,代码行数:8,代码来源:test_git_config.py

示例8: test_url_https_trailing_slash

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
开发者ID:alkino,项目名称:qibuild,代码行数:8,代码来源:test_git_config.py

示例9: test_url_http

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"
开发者ID:alkino,项目名称:qibuild,代码行数:8,代码来源:test_git_config.py

示例10: test_url_win_filepath

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"
开发者ID:alkino,项目名称:qibuild,代码行数:8,代码来源:test_git_config.py

示例11: test_url_win_filepath

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"
开发者ID:aldebaran,项目名称:qibuild,代码行数:9,代码来源:test_git_config.py

示例12: test_url_ssh_no_username

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"
开发者ID:alkino,项目名称:qibuild,代码行数:11,代码来源:test_git_config.py

示例13: test_warn_on_default_change

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"
开发者ID:aldebaran,项目名称:qibuild,代码行数:28,代码来源:test_project.py

示例14: test_apply_git_config

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"
开发者ID:aldebaran,项目名称:qibuild,代码行数:19,代码来源:test_project.py

示例15: test_gerrit_url_ssh_subfolder

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/"
开发者ID:alkino,项目名称:qibuild,代码行数:11,代码来源:test_git_config.py


注:本文中的qisrc.git_config.Remote类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。