Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
镜像
Python_Packaging_Authority
pip
提交
933a5ad3
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,发现更多精彩内容 >>
提交
933a5ad3
编写于
4月 15, 2010
作者:
A
Alexandre Conrad
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
remove hardcoded 'svn' and 'hg' commands
上级
44c988a4
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
21 addition
and
21 deletion
+21
-21
pip/vcs/__init__.py
pip/vcs/__init__.py
+2
-2
pip/vcs/mercurial.py
pip/vcs/mercurial.py
+12
-12
pip/vcs/subversion.py
pip/vcs/subversion.py
+7
-7
未找到文件。
pip/vcs/__init__.py
浏览文件 @
933a5ad3
...
...
@@ -97,8 +97,8 @@ class VersionControl(object):
return
self
.
_cmd
command
=
find_command
(
self
.
name
)
if
command
is
None
:
raise
BadCommand
(
'Cannot find command %
s
'
%
self
.
name
)
logger
.
info
(
'Found command %
s at %s
'
%
(
self
.
name
,
command
))
raise
BadCommand
(
'Cannot find command %
r
'
%
self
.
name
)
logger
.
info
(
'Found command %
r at %r
'
%
(
self
.
name
,
command
))
self
.
_cmd
=
command
return
command
...
...
pip/vcs/mercurial.py
浏览文件 @
933a5ad3
...
...
@@ -42,7 +42,7 @@ class Mercurial(VersionControl):
if
os
.
path
.
exists
(
location
):
os
.
rmdir
(
location
)
call_subprocess
(
[
'hg'
,
'clone'
,
url
,
location
],
[
self
.
cmd
,
'clone'
,
url
,
location
],
filter_stdout
=
self
.
_filter
,
show_stdout
=
False
)
finally
:
logger
.
indent
-=
2
...
...
@@ -53,7 +53,7 @@ class Mercurial(VersionControl):
self
.
unpack
(
temp_dir
)
try
:
call_subprocess
(
[
'hg'
,
'archive'
,
location
],
[
self
.
cmd
,
'archive'
,
location
],
filter_stdout
=
self
.
_filter
,
show_stdout
=
False
,
cwd
=
temp_dir
)
finally
:
shutil
.
rmtree
(
temp_dir
)
...
...
@@ -72,12 +72,12 @@ class Mercurial(VersionControl):
'Could not switch Mercurial repository to %s: %s'
%
(
url
,
e
))
else
:
call_subprocess
([
'hg'
,
'update'
,
'-q'
]
+
rev_options
,
cwd
=
dest
)
call_subprocess
([
self
.
cmd
,
'update'
,
'-q'
]
+
rev_options
,
cwd
=
dest
)
def
update
(
self
,
dest
,
rev_options
):
call_subprocess
([
'hg'
,
'pull'
,
'-q'
],
cwd
=
dest
)
call_subprocess
([
self
.
cmd
,
'pull'
,
'-q'
],
cwd
=
dest
)
call_subprocess
(
[
'hg'
,
'update'
,
'-q'
]
+
rev_options
,
cwd
=
dest
)
[
self
.
cmd
,
'update'
,
'-q'
]
+
rev_options
,
cwd
=
dest
)
def
obtain
(
self
,
dest
):
url
,
rev
=
self
.
get_url_rev
()
...
...
@@ -90,12 +90,12 @@ class Mercurial(VersionControl):
if
self
.
check_destination
(
dest
,
url
,
rev_options
,
rev_display
):
logger
.
notify
(
'Cloning hg %s%s to %s'
%
(
url
,
rev_display
,
display_path
(
dest
)))
call_subprocess
([
'hg'
,
'clone'
,
'--noupdate'
,
'-q'
,
url
,
dest
])
call_subprocess
([
'hg'
,
'update'
,
'-q'
]
+
rev_options
,
cwd
=
dest
)
call_subprocess
([
self
.
cmd
,
'clone'
,
'--noupdate'
,
'-q'
,
url
,
dest
])
call_subprocess
([
self
.
cmd
,
'update'
,
'-q'
]
+
rev_options
,
cwd
=
dest
)
def
get_url
(
self
,
location
):
url
=
call_subprocess
(
[
'hg'
,
'showconfig'
,
'paths.default'
],
[
self
.
cmd
,
'showconfig'
,
'paths.default'
],
show_stdout
=
False
,
cwd
=
location
).
strip
()
if
url
.
startswith
(
'/'
)
or
url
.
startswith
(
'
\\
'
):
url
=
path_to_url
(
url
)
...
...
@@ -103,7 +103,7 @@ class Mercurial(VersionControl):
def
get_tag_revs
(
self
,
location
):
tags
=
call_subprocess
(
[
'hg'
,
'tags'
],
show_stdout
=
False
,
cwd
=
location
)
[
self
.
cmd
,
'tags'
],
show_stdout
=
False
,
cwd
=
location
)
tag_revs
=
[]
for
line
in
tags
.
splitlines
():
tags_match
=
re
.
search
(
r
'([\w\d\.-]+)\s*([\d]+):.*$'
,
line
)
...
...
@@ -115,7 +115,7 @@ class Mercurial(VersionControl):
def
get_branch_revs
(
self
,
location
):
branches
=
call_subprocess
(
[
'hg'
,
'branches'
],
show_stdout
=
False
,
cwd
=
location
)
[
self
.
cmd
,
'branches'
],
show_stdout
=
False
,
cwd
=
location
)
branch_revs
=
[]
for
line
in
branches
.
splitlines
():
branches_match
=
re
.
search
(
r
'([\w\d\.-]+)\s*([\d]+):.*$'
,
line
)
...
...
@@ -127,13 +127,13 @@ class Mercurial(VersionControl):
def
get_revision
(
self
,
location
):
current_revision
=
call_subprocess
(
[
'hg'
,
'parents'
,
'--template={rev}'
],
[
self
.
cmd
,
'parents'
,
'--template={rev}'
],
show_stdout
=
False
,
cwd
=
location
).
strip
()
return
current_revision
def
get_revision_hash
(
self
,
location
):
current_rev_hash
=
call_subprocess
(
[
'hg'
,
'parents'
,
'--template={node}'
],
[
self
.
cmd
,
'parents'
,
'--template={node}'
],
show_stdout
=
False
,
cwd
=
location
).
strip
()
return
current_rev_hash
...
...
pip/vcs/subversion.py
浏览文件 @
933a5ad3
...
...
@@ -24,7 +24,7 @@ class Subversion(VersionControl):
"""Returns (url, revision), where both are strings"""
assert
not
location
.
rstrip
(
'/'
).
endswith
(
self
.
dirname
),
'Bad directory: %s'
%
location
output
=
call_subprocess
(
[
'svn'
,
'info'
,
location
],
show_stdout
=
False
,
extra_environ
=
{
'LANG'
:
'C'
})
[
self
.
cmd
,
'info'
,
location
],
show_stdout
=
False
,
extra_environ
=
{
'LANG'
:
'C'
})
match
=
_svn_url_re
.
search
(
output
)
if
not
match
:
logger
.
warn
(
'Cannot determine URL of svn checkout %s'
%
display_path
(
location
))
...
...
@@ -61,7 +61,7 @@ class Subversion(VersionControl):
# --force fixes this, but was only added in svn 1.5
rmtree
(
location
)
call_subprocess
(
[
'svn'
,
'checkout'
,
url
,
location
],
[
self
.
cmd
,
'checkout'
,
url
,
location
],
filter_stdout
=
self
.
_filter
,
show_stdout
=
False
)
finally
:
logger
.
indent
-=
2
...
...
@@ -77,18 +77,18 @@ class Subversion(VersionControl):
# --force fixes this, but was only added in svn 1.5
rmtree
(
location
)
call_subprocess
(
[
'svn'
,
'export'
,
url
,
location
],
[
self
.
cmd
,
'export'
,
url
,
location
],
filter_stdout
=
self
.
_filter
,
show_stdout
=
False
)
finally
:
logger
.
indent
-=
2
def
switch
(
self
,
dest
,
url
,
rev_options
):
call_subprocess
(
[
'svn'
,
'switch'
]
+
rev_options
+
[
url
,
dest
])
[
self
.
cmd
,
'switch'
]
+
rev_options
+
[
url
,
dest
])
def
update
(
self
,
dest
,
rev_options
):
call_subprocess
(
[
'svn'
,
'update'
]
+
rev_options
+
[
dest
])
[
self
.
cmd
,
'update'
]
+
rev_options
+
[
dest
])
def
obtain
(
self
,
dest
):
url
,
rev
=
self
.
get_url_rev
()
...
...
@@ -102,7 +102,7 @@ class Subversion(VersionControl):
logger
.
notify
(
'Checking out %s%s to %s'
%
(
url
,
rev_display
,
display_path
(
dest
)))
call_subprocess
(
[
'svn'
,
'checkout'
,
'-q'
]
+
rev_options
+
[
url
,
dest
])
[
self
.
cmd
,
'checkout'
,
'-q'
]
+
rev_options
+
[
url
,
dest
])
def
get_location
(
self
,
dist
,
dependency_links
):
egg_fragment_re
=
re
.
compile
(
r
'#egg=(.*)$'
)
...
...
@@ -205,7 +205,7 @@ class Subversion(VersionControl):
def
get_tag_revs
(
self
,
svn_tag_url
):
stdout
=
call_subprocess
(
[
'svn'
,
'ls'
,
'-v'
,
svn_tag_url
],
show_stdout
=
False
)
[
self
.
cmd
,
'ls'
,
'-v'
,
svn_tag_url
],
show_stdout
=
False
)
results
=
[]
for
line
in
stdout
.
splitlines
():
parts
=
line
.
split
()
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录