本文整理汇总了Python中pip._internal.vcs.git.Git.resolve_revision方法的典型用法代码示例。如果您正苦于以下问题:Python Git.resolve_revision方法的具体用法?Python Git.resolve_revision怎么用?Python Git.resolve_revision使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pip._internal.vcs.git.Git
的用法示例。
在下文中一共展示了Git.resolve_revision方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_git_resolve_revision_rev_not_found
# 需要导入模块: from pip._internal.vcs.git import Git [as 别名]
# 或者: from pip._internal.vcs.git.Git import resolve_revision [as 别名]
def test_git_resolve_revision_rev_not_found(get_sha_mock):
get_sha_mock.return_value = (None, False)
url = 'git+https://git.example.com'
rev_options = Git.make_rev_options('develop')
new_options = Git.resolve_revision('.', url, rev_options)
assert new_options.rev == 'develop'
示例2: test_git_resolve_revision_rev_exists
# 需要导入模块: from pip._internal.vcs.git import Git [as 别名]
# 或者: from pip._internal.vcs.git.Git import resolve_revision [as 别名]
def test_git_resolve_revision_rev_exists(get_sha_mock):
get_sha_mock.return_value = ('123456', False)
git = Git()
rev_options = git.make_rev_options('develop')
url = 'git+https://git.example.com'
new_options = git.resolve_revision('.', url, rev_options)
assert new_options.rev == '123456'
示例3: test_git_resolve_revision_not_found_warning
# 需要导入模块: from pip._internal.vcs.git import Git [as 别名]
# 或者: from pip._internal.vcs.git.Git import resolve_revision [as 别名]
def test_git_resolve_revision_not_found_warning(get_sha_mock, caplog):
get_sha_mock.return_value = (None, False)
url = 'git+https://git.example.com'
sha = 40 * 'a'
rev_options = Git.make_rev_options(sha)
new_options = Git.resolve_revision('.', url, rev_options)
assert new_options.rev == sha
rev_options = Git.make_rev_options(sha[:6])
new_options = Git.resolve_revision('.', url, rev_options)
assert new_options.rev == 'aaaaaa'
# Check that a warning got logged only for the abbreviated hash.
messages = [r.getMessage() for r in caplog.records]
messages = [msg for msg in messages if msg.startswith('Did not find ')]
assert messages == [
"Did not find branch or tag 'aaaaaa', assuming revision or ref."
]