本文整理汇总了Python中pip.vcs.git.Git.get_branch_revs方法的典型用法代码示例。如果您正苦于以下问题:Python Git.get_branch_revs方法的具体用法?Python Git.get_branch_revs怎么用?Python Git.get_branch_revs使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pip.vcs.git.Git
的用法示例。
在下文中一共展示了Git.get_branch_revs方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_get_branch_revs_should_return_branch_name_and_commit_pair
# 需要导入模块: from pip.vcs.git import Git [as 别名]
# 或者: from pip.vcs.git.Git import get_branch_revs [as 别名]
def test_get_branch_revs_should_return_branch_name_and_commit_pair():
env = reset_env()
version_pkg_path = _create_test_package(env)
env.run('git', 'branch', 'branch0.1', cwd=version_pkg_path)
commit = env.run('git', 'rev-parse', 'HEAD',
cwd=version_pkg_path).stdout.strip()
git = Git()
result = git.get_branch_revs(version_pkg_path)
assert result == {'master': commit, 'branch0.1': commit}
示例2: test_get_branch_revs_should_ignore_no_branch
# 需要导入模块: from pip.vcs.git import Git [as 别名]
# 或者: from pip.vcs.git.Git import get_branch_revs [as 别名]
def test_get_branch_revs_should_ignore_no_branch():
env = reset_env()
version_pkg_path = _create_test_package(env)
env.run('git', 'branch', 'branch0.1', cwd=version_pkg_path)
commit = env.run('git', 'rev-parse', 'HEAD',
cwd=version_pkg_path).stdout.strip()
# current branch here is "* (nobranch)"
env.run('git', 'checkout', commit,
cwd=version_pkg_path, expect_stderr=True)
git = Git()
result = git.get_branch_revs(version_pkg_path)
assert result == {'master': commit, 'branch0.1': commit}