當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。