Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
镜像
Python_Packaging_Authority
pip
提交
d1b94415
P
pip
项目概览
镜像
/
Python_Packaging_Authority
/
pip
12 个月 前同步成功
通知
0
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
pip
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
d1b94415
编写于
8月 13, 2017
作者:
C
Chris Jerdonek
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Change check_version() to accept a commit hash / id.
上级
3e4f8089
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
15 addition
and
14 deletion
+15
-14
src/pip/_internal/vcs/__init__.py
src/pip/_internal/vcs/__init__.py
+3
-2
src/pip/_internal/vcs/bazaar.py
src/pip/_internal/vcs/bazaar.py
+1
-1
src/pip/_internal/vcs/git.py
src/pip/_internal/vcs/git.py
+6
-5
src/pip/_internal/vcs/mercurial.py
src/pip/_internal/vcs/mercurial.py
+1
-1
src/pip/_internal/vcs/subversion.py
src/pip/_internal/vcs/subversion.py
+1
-1
tests/unit/test_vcs.py
tests/unit/test_vcs.py
+3
-4
未找到文件。
src/pip/_internal/vcs/__init__.py
浏览文件 @
d1b94415
...
...
@@ -279,7 +279,7 @@ class VersionControl(object):
"""
raise
NotImplementedError
def
check_version
(
self
,
dest
,
rev_options
):
def
check_version
(
self
,
dest
,
commit_id
):
"""
Return True if the version is identical to what exists and
doesn't need to be updated.
...
...
@@ -313,7 +313,8 @@ class VersionControl(object):
display_path
(
dest
),
url
,
)
if
not
self
.
check_version
(
dest
,
rev_options
):
commit_id
=
rev_options
[
0
]
if
not
self
.
check_version
(
dest
,
commit_id
):
logger
.
info
(
'Updating %s %s%s'
,
display_path
(
dest
),
...
...
src/pip/_internal/vcs/bazaar.py
浏览文件 @
d1b94415
...
...
@@ -104,7 +104,7 @@ class Bazaar(VersionControl):
current_rev
=
self
.
get_revision
(
location
)
return
'%s@%s#egg=%s'
%
(
repo
,
current_rev
,
egg_project_name
)
def
check_version
(
self
,
dest
,
rev_options
):
def
check_version
(
self
,
dest
,
commit_id
):
"""Always assume the versions don't match"""
return
False
...
...
src/pip/_internal/vcs/git.py
浏览文件 @
d1b94415
...
...
@@ -119,7 +119,7 @@ class Git(VersionControl):
return
rev_options
def
check_version
(
self
,
dest
,
rev_options
):
def
check_version
(
self
,
dest
,
commit_id
):
"""
Compare the current sha to the ref. ref may be a branch or tag name,
but current rev will always point to a sha. This means that a branch
...
...
@@ -129,7 +129,7 @@ class Git(VersionControl):
Args:
rev_options: a RevOptions object.
"""
return
self
.
get_revision
(
dest
)
==
rev_options
.
arg_rev
return
self
.
get_revision
(
dest
)
==
commit_id
def
switch
(
self
,
dest
,
url
,
rev_options
):
self
.
run_command
([
'config'
,
'remote.origin.url'
,
url
],
cwd
=
dest
)
...
...
@@ -164,10 +164,11 @@ class Git(VersionControl):
if
rev
:
rev_options
=
self
.
check_rev_options
(
dest
,
rev_options
)
# Only do a checkout if rev_options differs from HEAD
if
not
self
.
check_version
(
dest
,
rev_options
):
commit_hash
=
rev_options
.
rev
# Only do a checkout if HEAD differs from commit_hash.
if
not
self
.
check_version
(
dest
,
commit_hash
):
cmd_args
=
[
'fetch'
,
'-q'
,
url
]
+
rev_options
.
to_args
()
self
.
run_command
(
cmd_args
,
cwd
=
dest
,
)
self
.
run_command
(
cmd_args
,
cwd
=
dest
)
self
.
run_command
(
[
'checkout'
,
'-q'
,
'FETCH_HEAD'
],
cwd
=
dest
,
...
...
src/pip/_internal/vcs/mercurial.py
浏览文件 @
d1b94415
...
...
@@ -97,7 +97,7 @@ class Mercurial(VersionControl):
current_rev_hash
=
self
.
get_revision_hash
(
location
)
return
'%s@%s#egg=%s'
%
(
repo
,
current_rev_hash
,
egg_project_name
)
def
check_version
(
self
,
dest
,
rev_options
):
def
check_version
(
self
,
dest
,
commit_id
):
"""Always assume the versions don't match"""
return
False
...
...
src/pip/_internal/vcs/subversion.py
浏览文件 @
d1b94415
...
...
@@ -217,7 +217,7 @@ class Subversion(VersionControl):
rev
=
self
.
get_revision
(
location
)
return
'svn+%s@%s#egg=%s'
%
(
repo
,
rev
,
egg_project_name
)
def
check_version
(
self
,
dest
,
rev_options
):
def
check_version
(
self
,
dest
,
commit_id
):
"""Always assume the versions don't match"""
return
False
...
...
tests/unit/test_vcs.py
浏览文件 @
d1b94415
...
...
@@ -118,16 +118,15 @@ def test_git_get_src_requirements(git, dist):
])
@
pytest
.
mark
.
parametrize
(
'
ref
,result'
,
(
@
pytest
.
mark
.
parametrize
(
'
commit
,result'
,
(
(
'5547fa909e83df8bd743d3978d6667497983a4b7'
,
True
),
(
'5547fa909'
,
False
),
(
'5678'
,
False
),
(
'abc123'
,
False
),
(
'foo'
,
False
),
))
def
test_git_check_version
(
git
,
ref
,
result
):
rev_options
=
git
.
make_rev_options
(
ref
)
assert
git
.
check_version
(
'foo'
,
rev_options
)
is
result
def
test_git_check_version
(
git
,
commit
,
result
):
assert
git
.
check_version
(
'/path'
,
commit
)
is
result
def
test_translate_egg_surname
():
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录