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


Python TestGit.commit_file方法代码示例

本文整理汇总了Python中qisrc.test.conftest.TestGit.commit_file方法的典型用法代码示例。如果您正苦于以下问题:Python TestGit.commit_file方法的具体用法?Python TestGit.commit_file怎么用?Python TestGit.commit_file使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在qisrc.test.conftest.TestGit的用法示例。


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

示例1: test_sync_branch_devel

# 需要导入模块: from qisrc.test.conftest import TestGit [as 别名]
# 或者: from qisrc.test.conftest.TestGit import commit_file [as 别名]
def test_sync_branch_devel(qisrc_action, git_server, test_git):
    # This tests the case where everything goes smoothly
    git_server.create_repo("foo.git")
    qisrc_action("init", git_server.manifest_url)
    git_server.push_file("foo.git", "foo.txt", "a super change")
    git_server.push_file("foo.git", "bar.txt", "a super bugfix")
    git_worktree = TestGitWorkTree()

    foo = git_worktree.get_git_project("foo")

    test_git = TestGit(foo.path)
    test_git.call("checkout", "-b", "devel")

    test_git.commit_file("developing.txt", "like a boss")
    git_server.push_file("foo.git", "foobar.txt", "some other change")
    git_server.push_file("foo.git", "bigchange.txt", "some huge change")

    qisrc_action("sync", "--rebase-devel")
    test_git.call("checkout", "master")
    # Check that master is fast-forwarded
    bigchange_txt = os.path.join(foo.path, "bigchange.txt")
    assert os.path.exists(bigchange_txt)

    # Check rebase is done smoothly
    test_git.call("checkout", "devel")
    test_git.call("rebase", "master")
    assert os.path.exists(bigchange_txt)
    developing_txt = os.path.join(foo.path, "developing.txt")
    assert os.path.exists(developing_txt)
开发者ID:cameronyoyos,项目名称:qibuild,代码行数:31,代码来源:test_qisrc_sync.py

示例2: test_when_ahead

# 需要导入模块: from qisrc.test.conftest import TestGit [as 别名]
# 或者: from qisrc.test.conftest.TestGit import commit_file [as 别名]
def test_when_ahead(git_server, qisrc_action):
    git_server.create_repo("foo")
    git_server.switch_manifest_branch("devel")
    git_server.change_branch("foo", "devel")
    qisrc_action("init", git_server.manifest_url, "--branch", "devel")
    git_worktree = TestGitWorkTree()
    foo_proj = git_worktree.get_git_project("foo")
    git = TestGit(foo_proj.path)
    git.commit_file("devel.txt", "devel")
    git.push()
    qisrc_action("rebase", "--all")
开发者ID:Mhalla,项目名称:qibuild,代码行数:13,代码来源:test_qisrc_rebase.py

示例3: test_publish_changes

# 需要导入模块: from qisrc.test.conftest import TestGit [as 别名]
# 或者: from qisrc.test.conftest.TestGit import commit_file [as 别名]
def test_publish_changes(qisrc_action, git_server):
    foo_repo = git_server.create_repo("foo.git", review=True)
    qisrc_action("init", git_server.manifest_url)
    git_worktree = TestGitWorkTree()
    foo_proj = git_worktree.get_git_project("foo")
    foo_git = TestGit(foo_proj.path)
    foo_git.commit_file("a.txt", "a")
    qisrc_action("push", "foo")
    _, sha1 = foo_git.call("log", "-1", "--pretty=%H", raises=False)
    (_, remote) = foo_git.call("ls-remote", "gerrit", "refs/for/master", raises=False)
    assert remote == "%s\trefs/for/master" % sha1
开发者ID:Fantomatic,项目名称:qibuild,代码行数:13,代码来源:test_qisrc_push.py

示例4: test_not_under_code_review

# 需要导入模块: from qisrc.test.conftest import TestGit [as 别名]
# 或者: from qisrc.test.conftest.TestGit import commit_file [as 别名]
def test_not_under_code_review(qisrc_action, git_server):
    foo_repo = git_server.create_repo("foo.git")
    qisrc_action("init", git_server.manifest_url)
    git_worktree = TestGitWorkTree()
    foo_proj = git_worktree.get_git_project("foo")
    foo_git = TestGit(foo_proj.path)
    foo_git.commit_file("a.txt", "a")
    qisrc_action("push", "foo")
    _, sha1 = foo_git.call("log", "-1", "--pretty=%H", raises=False)
    (_, remote) = foo_git.call("ls-remote", "origin", "master", raises=False)
    assert remote == "%s\trefs/heads/master" % sha1
开发者ID:Fantomatic,项目名称:qibuild,代码行数:13,代码来源:test_qisrc_push.py

示例5: test_copy_git_src

# 需要导入模块: from qisrc.test.conftest import TestGit [as 别名]
# 或者: from qisrc.test.conftest.TestGit import commit_file [as 别名]
def test_copy_git_src(tmpdir):
    src = tmpdir.mkdir("src")
    dest = tmpdir.mkdir("dest")
    foo_src = src.mkdir("foo")
    foo_git = TestGit(foo_src.strpath)
    foo_git.initialize()
    foo_git.commit_file("a.txt", "a\n")
    foo_git.commit_file("b.txt", "a\n")
    foo_src.ensure("c.txt", file=True)
    qisys.sh.copy_git_src(foo_src.strpath, dest.strpath)
    assert dest.join("a.txt").check(file=True)
    assert not dest.join("c.txt").check(file=True)
开发者ID:Giessen,项目名称:qibuild,代码行数:14,代码来源:test_sh.py

示例6: test_using_carbon_copy

# 需要导入模块: from qisrc.test.conftest import TestGit [as 别名]
# 或者: from qisrc.test.conftest.TestGit import commit_file [as 别名]
def test_using_carbon_copy(qisrc_action, git_server):
    foo_repo = git_server.create_repo("foo.git", review=True)
    qisrc_action("init", git_server.manifest_url)
    git_worktree = TestGitWorkTree()
    foo_proj = git_worktree.get_git_project("foo")
    foo_git = TestGit(foo_proj.path)
    # Need to fetch gerrit remote at least once for gerrit/master to exist
    foo_git.fetch("--all")
    foo_git.commit_file("a.txt", "a")
    with mock.patch.object(qisys.command, "call") as mocked_call:
        qisrc_action("push", "foo", "--cc", "jdoe")
    set_reviewers_args =  mocked_call.call_args_list[2][0][0][7]
    assert "jdoe" in set_reviewers_args
开发者ID:Fantomatic,项目名称:qibuild,代码行数:15,代码来源:test_qisrc_push.py

示例7: test_fixed_ref

# 需要导入模块: from qisrc.test.conftest import TestGit [as 别名]
# 或者: from qisrc.test.conftest.TestGit import commit_file [as 别名]
def test_fixed_ref(qisrc_action, git_server):
    """ Test Fixed Ref """
    git_server.create_repo("foo.git")
    git_server.push_tag("foo.git", "v0.1")
    git_server.set_fixed_ref("foo.git", "v0.1")
    qisrc_action("init", git_server.manifest_url)
    git_worktree = TestGitWorkTree()
    foo_proj = git_worktree.get_git_project("foo")
    git = TestGit(foo_proj.path)
    git.commit_file("a.txt", "a", "test")
    qisrc_action("reset")
    _, actual = git.call("rev-parse", "HEAD", raises=False)
    _, expected = git.call("rev-parse", "v0.1", raises=False)
    assert actual == expected
开发者ID:aldebaran,项目名称:qibuild,代码行数:16,代码来源:test_qisrc_reset.py

示例8: test_happy_rebase

# 需要导入模块: from qisrc.test.conftest import TestGit [as 别名]
# 或者: from qisrc.test.conftest.TestGit import commit_file [as 别名]
def test_happy_rebase(git_server, qisrc_action):
    git_server.create_repo("foo")
    git_server.switch_manifest_branch("devel")
    git_server.change_branch("foo", "devel")
    qisrc_action("init", git_server.manifest_url, "--branch", "devel")
    git_server.push_file("foo", "master.txt", "master")
    git_worktree = TestGitWorkTree()
    foo_proj = git_worktree.get_git_project("foo")
    git = TestGit(foo_proj.path)
    git.commit_file("devel.txt", "devel")
    git.push()
    git.fetch()
    qisrc_action("rebase", "--branch", "master", "--all")
    rc, out = git.log("--pretty=oneline", raises=False)
    assert len(out.splitlines()) == 3
开发者ID:Mhalla,项目名称:qibuild,代码行数:17,代码来源:test_qisrc_rebase.py

示例9: test_when_moved

# 需要导入模块: from qisrc.test.conftest import TestGit [as 别名]
# 或者: from qisrc.test.conftest.TestGit import commit_file [as 别名]
def test_when_moved(git_server, qisrc_action, record_messages):
    """ Test When Moved """
    git_server.create_repo("foo")
    git_server.switch_manifest_branch("devel")
    git_server.change_branch("foo", "devel")
    git_server.move_repo("foo", "lib/foo")
    qisrc_action("init", git_server.manifest_url, "--branch", "devel")
    git_server.push_file("foo", "master.txt", "master")
    git_worktree = TestGitWorkTree()
    foo_proj = git_worktree.get_git_project("lib/foo")
    git = TestGit(foo_proj.path)
    git.commit_file("devel.txt", "devel")
    git.push()
    qisrc_action("rebase", "--branch", "master", "--all")
    _rc, out = git.log("--pretty=oneline", raises=False)
    assert len(out.splitlines()) == 3
开发者ID:aldebaran,项目名称:qibuild,代码行数:18,代码来源:test_qisrc_rebase.py

示例10: test_not_under_code_review_ask_user

# 需要导入模块: from qisrc.test.conftest import TestGit [as 别名]
# 或者: from qisrc.test.conftest.TestGit import commit_file [as 别名]
def test_not_under_code_review_ask_user(qisrc_action, git_server, interact):
    """ Test Not Under Code Review Ask User """
    _foo_repo = git_server.create_repo("foo.git")
    qisrc_action("init", git_server.manifest_url)
    git_worktree = TestGitWorkTree()
    foo_proj = git_worktree.get_git_project("foo")
    foo_git = TestGit(foo_proj.path)
    foo_git.commit_file("a.txt", "a")
    interact.answers = [False, True]
    qisrc_action("push", "--project", "foo")
    _, sha1 = foo_git.call("log", "-1", "--pretty=%H", raises=False)
    (_, remote) = foo_git.call("ls-remote", "origin", "master", raises=False)
    assert remote != "%s\trefs/heads/master" % sha1
    qisrc_action("push", "--project", "foo")
    (_, remote) = foo_git.call("ls-remote", "origin", "master", raises=False)
    assert remote == "%s\trefs/heads/master" % sha1
开发者ID:aldebaran,项目名称:qibuild,代码行数:18,代码来源:test_qisrc_push.py

示例11: test_sync_branch_devel_no_ff

# 需要导入模块: from qisrc.test.conftest import TestGit [as 别名]
# 或者: from qisrc.test.conftest.TestGit import commit_file [as 别名]
def test_sync_branch_devel_no_ff(qisrc_action, git_server, test_git):
    """ Test Sync Branc Devel No Fast Forward """
    # Case where master can't be fast-forwarded, does nothing except warning
    git_server.create_repo("foo.git")
    qisrc_action("init", git_server.manifest_url)
    git_server.push_file("foo.git", "foo.txt", "a super change")
    git_worktree = TestGitWorkTree()
    foo1 = git_worktree.get_git_project("foo")
    test_git = TestGit(foo1.path)
    test_git.commit_file("foo.git", "div.txt", "diverging from master")
    master_sha1 = test_git.get_ref_sha1("refs/heads/master")
    test_git.call("checkout", "-b", "devel")
    test_git.commit_file("developing.txt", "like a boss")
    git_server.push_file("foo.git", "foobar.txt", "some other change")
    qisrc_action("sync", "--rebase-devel")
    # Master HEAD is untouched
    assert test_git.get_ref_sha1("refs/heads/master") == master_sha1
开发者ID:aldebaran,项目名称:qibuild,代码行数:19,代码来源:test_qisrc_sync.py

示例12: test_sync_reset

# 需要导入模块: from qisrc.test.conftest import TestGit [as 别名]
# 或者: from qisrc.test.conftest.TestGit import commit_file [as 别名]
def test_sync_reset(qisrc_action, git_server):
    """ Test Sync Reset """
    git_server.create_repo("bar")
    git_server.create_repo("baz")
    qisrc_action("init", git_server.manifest_url)
    git_worktree = TestGitWorkTree()
    bar_proj = git_worktree.get_git_project("bar")
    baz_proj = git_worktree.get_git_project("baz")
    bar_git = TestGit(bar_proj.path)
    baz_git = TestGit(baz_proj.path)
    bar_git.checkout("-B", "devel")
    baz_git.commit_file("unrelated.txt", "unrelated\n")
    git_server.push_file("bar", "bar.txt", "this is bar\n")
    qisrc_action("sync", "--reset")
    assert bar_git.get_current_branch() == "master"
    assert bar_git.read_file("bar.txt") == "this is bar\n"
    with pytest.raises(Exception):
        baz_git.read_file("unrelated.txt")
开发者ID:aldebaran,项目名称:qibuild,代码行数:20,代码来源:test_qisrc_sync.py

示例13: test_sync_branch_devel_unclean

# 需要导入模块: from qisrc.test.conftest import TestGit [as 别名]
# 或者: from qisrc.test.conftest.TestGit import commit_file [as 别名]
def test_sync_branch_devel_unclean(qisrc_action, git_server, test_git):
    """ Test Sync Branch Devel UnClean """
    # Case where the worktree isn't clean
    git_server.create_repo("foo.git")
    qisrc_action("init", git_server.manifest_url)
    git_server.push_file("foo.git", "foo.txt", "a super change")
    git_server.push_file("foo.git", "bar.txt", "a super bugfix")
    git_worktree = TestGitWorkTree()
    foo1 = git_worktree.get_git_project("foo")
    test_git = TestGit(foo1.path)
    test_git.call("checkout", "-b", "devel")
    test_git.commit_file("developing.txt", "like a boss")
    git_server.push_file("foo.git", "foobar.txt", "some other change")
    wip_txt = os.path.join(foo1.path, "wip.txt")
    open(wip_txt, 'w').close()
    qisys.script.run_action("qisrc.actions.sync", ["--rebase-devel"])
    # Master has been fast-forwarded and I haven't lost my WIP
    assert os.path.exists(wip_txt)
开发者ID:aldebaran,项目名称:qibuild,代码行数:20,代码来源:test_qisrc_sync.py

示例14: test_push_after_rebase

# 需要导入模块: from qisrc.test.conftest import TestGit [as 别名]
# 或者: from qisrc.test.conftest.TestGit import commit_file [as 别名]
def test_push_after_rebase(git_server, git_worktree, qisrc_action, interact):
    git_server.create_repo("foo")
    git_server.switch_manifest_branch("devel")
    git_server.change_branch("foo", "devel")
    git_server.push_file("foo", "master.txt", "devel")
    qisrc_action("init", git_server.manifest_url, "--branch", "devel")
    git_server.push_file("foo", "master.txt", "master")
    git_worktree = TestGitWorkTree()
    foo_proj = git_worktree.get_git_project("foo")
    git = TestGit(foo_proj.path)
    git.commit_file("devel.txt", "devel")
    git.fetch()
    git.push("origin", "devel")
    interact.answers = [True]
    qisrc_action("rebase", "--branch", "master", "--push", "--force", "--all")
    local_sha1 = git.get_ref_sha1("refs/heads/devel")
    remote_sha1 = git.get_ref_sha1("refs/remotes/origin/devel")
    assert local_sha1 == remote_sha1
开发者ID:Mhalla,项目名称:qibuild,代码行数:20,代码来源:test_qisrc_rebase.py

示例15: test_alert_maintainers

# 需要导入模块: from qisrc.test.conftest import TestGit [as 别名]
# 或者: from qisrc.test.conftest.TestGit import commit_file [as 别名]
def test_alert_maintainers(qisrc_action, git_server):
    foo_repo = git_server.create_repo("foo.git", review=True)
    qiproject_xml = """\
<project version="3">
  <maintainer email="[email protected]">John Doe</maintainer>
</project>"""
    git_server.push_file("foo.git", "qiproject.xml", qiproject_xml)
    qisrc_action("init", git_server.manifest_url)
    git_worktree = TestGitWorkTree()
    foo_proj = git_worktree.get_git_project("foo")
    foo_git = TestGit(foo_proj.path)
    # Need to fetch gerrit remote at least once for gerrit/master to exist
    foo_git.fetch("--all")
    foo_git.commit_file("a.txt", "a")
    with mock.patch.object(qisys.command, "call") as mocked_call:
        qisrc_action("push", "foo")
    set_reviewers_args =  mocked_call.call_args_list[3][0][0][7]
    assert "[email protected]" in set_reviewers_args
开发者ID:Fantomatic,项目名称:qibuild,代码行数:20,代码来源:test_qisrc_push.py


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