Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
镜像
Python_Packaging_Authority
pip
提交
3fce1554
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,发现更多精彩内容 >>
提交
3fce1554
编写于
10月 03, 2009
作者:
C
Carl Meyer
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix #55 (frozen editable URLs use revision hash/id only)
上级
3dfdff51
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
44 addition
and
83 deletion
+44
-83
docs/news.txt
docs/news.txt
+3
-0
pip.py
pip.py
+36
-72
tests/test_freeze.txt
tests/test_freeze.txt
+5
-11
未找到文件。
docs/news.txt
浏览文件 @
3fce1554
...
...
@@ -40,6 +40,9 @@ tip
* Fixed handling read-only attributes of build files, e.g. of Subversion and
Bazaar on Windows.
* Editable freeze URLs now always use revision hash/id rather than tip or
branch names which could move.
0.4
---
...
...
pip.py
浏览文件 @
3fce1554
...
...
@@ -2978,29 +2978,29 @@ class Subversion(VersionControl):
parts
=
repo
.
split
(
'/'
)
## FIXME: why not project name?
egg_project_name
=
dist
.
egg_name
().
split
(
'-'
,
1
)[
0
]
rev
=
self
.
get_revision
(
location
)
if
parts
[
-
2
]
in
(
'tags'
,
'tag'
):
# It's a tag, perfect!
return
'svn+%s#egg=%s-%s'
%
(
repo
,
egg_project_name
,
parts
[
-
1
])
full_egg_name
=
'%s-%s'
%
(
egg_project_name
,
parts
[
-
1
])
elif
parts
[
-
2
]
in
(
'branches'
,
'branch'
):
# It's a branch :(
rev
=
self
.
get_revision
(
location
)
return
'svn+%s@%s#egg=%s%s-r%s'
%
(
repo
,
rev
,
dist
.
egg_name
(),
parts
[
-
1
],
rev
)
full_egg_name
=
'%s-%s-r%s'
%
(
dist
.
egg_name
(),
parts
[
-
1
],
rev
)
elif
parts
[
-
1
]
==
'trunk'
:
# Trunk :-/
rev
=
self
.
get_revision
(
location
)
full_egg_name
=
'%s-dev_r%s'
%
(
dist
.
egg_name
(),
rev
)
if
find_tags
:
tag_url
=
'/'
.
join
(
parts
[:
-
1
])
+
'/tags'
tag_revs
=
self
.
get_tag_revs
(
tag_url
)
match
=
self
.
find_tag_match
(
rev
,
tag_revs
)
if
match
:
logger
.
notify
(
'trunk checkout %s seems to be equivalent to tag %s'
%
match
)
re
turn
'svn+%s/%s#egg=%s-%s'
%
(
tag_url
,
match
,
egg_project_name
,
match
)
return
'svn+%s@%s#egg=%s-dev'
%
(
repo
,
rev
,
dist
.
egg_name
()
)
re
po
=
'%s/%s'
%
(
tag_url
,
match
)
full_egg_name
=
'%s-%s'
%
(
egg_project_name
,
match
)
else
:
# Don't know what it is
logger
.
warn
(
'svn URL does not fit normal structure (tags/branches/trunk): %s'
%
repo
)
rev
=
self
.
get_revision
(
location
)
return
'svn+%s@%s#egg=%s-dev'
%
(
repo
,
rev
,
egg_project
_name
)
full_egg_name
=
'%s-dev_r%s'
%
(
egg_project_name
,
rev
)
return
'svn+%s@%s#egg=%s'
%
(
repo
,
rev
,
full_egg
_name
)
vcs
.
register
(
Subversion
)
...
...
@@ -3141,11 +3141,6 @@ class Git(VersionControl):
[
GIT_CMD
,
'rev-parse'
,
'HEAD'
],
show_stdout
=
False
,
cwd
=
location
)
return
current_rev
.
strip
()
def
get_master_revision
(
self
,
location
):
master_rev
=
call_subprocess
(
[
GIT_CMD
,
'rev-parse'
,
'master'
],
show_stdout
=
False
,
cwd
=
location
)
return
master_rev
.
strip
()
def
get_tag_revs
(
self
,
location
):
tags
=
call_subprocess
(
[
GIT_CMD
,
'tag'
],
show_stdout
=
False
,
cwd
=
location
)
...
...
@@ -3180,28 +3175,20 @@ class Git(VersionControl):
return
None
current_rev
=
self
.
get_revision
(
location
)
tag_revs
=
self
.
get_tag_revs
(
location
)
master_rev
=
self
.
get_master_revision
(
location
)
branch_revs
=
self
.
get_branch_revs
(
location
)
if
current_rev
in
tag_revs
:
# It's a tag, perfect!
tag
=
tag_revs
.
get
(
current_rev
,
current_rev
)
return
'%s@%s#egg=%s-%s'
%
(
repo
,
tag
,
egg_project_name
,
tag
)
elif
current_rev
in
branch_revs
:
# It's the head of a branch, nice too.
branch
=
branch_revs
.
get
(
current_rev
,
current_rev
)
return
'%s@%s#egg=%s-%s'
%
(
repo
,
current_rev
,
dist
.
egg_name
(),
current_rev
)
elif
current_rev
==
master_rev
:
if
find_tags
:
if
current_rev
in
tag_revs
:
tag
=
tag_revs
.
get
(
current_rev
,
current_rev
)
logger
.
notify
(
'Revision %s seems to be equivalent to tag %s'
%
(
current_rev
,
tag
))
return
'%s@%s#egg=%s-%s'
%
(
repo
,
tag
,
egg_project_name
,
tag
)
return
'%s@%s#egg=%s-dev'
%
(
repo
,
master_rev
,
dist
.
egg_name
())
# It's a tag
full_egg_name
=
'%s-%s'
%
(
egg_project_name
,
tag_revs
[
current_rev
])
elif
(
current_rev
in
branch_revs
and
branch_revs
[
current_rev
]
!=
'origin/master'
):
# It's the head of a branch
full_egg_name
=
'%s-%s'
%
(
dist
.
egg_name
(),
branch_revs
[
current_rev
].
replace
(
'origin/'
,
''
))
else
:
# Don't know what it is
logger
.
warn
(
'Git URL does not fit normal structure: %s'
%
repo
)
return
'%s@%s#egg=%s-dev'
%
(
repo
,
current_rev
,
egg_project
_name
)
full_egg_name
=
'%s-dev'
%
dist
.
egg_name
()
return
'%s@%s#egg=%s'
%
(
repo
,
current_rev
,
full_egg
_name
)
def
get_url_rev
(
self
):
"""
...
...
@@ -3336,11 +3323,6 @@ class Mercurial(VersionControl):
url
=
filename_to_url
(
url
)
return
url
.
strip
()
def
get_tip_revision
(
self
,
location
):
current_rev
=
call_subprocess
(
[
'hg'
,
'tip'
,
'--template={rev}'
],
show_stdout
=
False
,
cwd
=
location
)
return
current_rev
.
strip
()
def
get_tag_revs
(
self
,
location
):
tags
=
call_subprocess
(
[
'hg'
,
'tags'
],
show_stdout
=
False
,
cwd
=
location
)
...
...
@@ -3371,6 +3353,12 @@ class Mercurial(VersionControl):
show_stdout
=
False
,
cwd
=
location
).
strip
()
return
current_revision
def
get_revision_hash
(
self
,
location
):
current_rev_hash
=
call_subprocess
(
[
'hg'
,
'parents'
,
'--template={node}'
],
show_stdout
=
False
,
cwd
=
location
).
strip
()
return
current_rev_hash
def
get_src_requirement
(
self
,
dist
,
location
,
find_tags
):
repo
=
self
.
get_url
(
location
)
if
not
repo
.
lower
().
startswith
(
'hg:'
):
...
...
@@ -3379,28 +3367,18 @@ class Mercurial(VersionControl):
if
not
repo
:
return
None
current_rev
=
self
.
get_revision
(
location
)
current_rev_hash
=
self
.
get_revision_hash
(
location
)
tag_revs
=
self
.
get_tag_revs
(
location
)
branch_revs
=
self
.
get_branch_revs
(
location
)
tip_rev
=
self
.
get_tip_revision
(
location
)
if
current_rev
in
tag_revs
:
# It's a tag, perfect!
tag
=
tag_revs
.
get
(
current_rev
,
current_rev
)
return
'%s@%s#egg=%s-%s'
%
(
repo
,
tag
,
egg_project_name
,
tag
)
# It's a tag
full_egg_name
=
'%s-%s'
%
(
egg_project_name
,
tag_revs
[
current_rev
])
elif
current_rev
in
branch_revs
:
# It's the tip of a branch, nice too.
branch
=
branch_revs
.
get
(
current_rev
,
current_rev
)
return
'%s@%s#egg=%s-%s'
%
(
repo
,
branch
,
dist
.
egg_name
(),
current_rev
)
elif
current_rev
==
tip_rev
:
if
find_tags
:
if
current_rev
in
tag_revs
:
tag
=
tag_revs
.
get
(
current_rev
,
current_rev
)
logger
.
notify
(
'Revision %s seems to be equivalent to tag %s'
%
(
current_rev
,
tag
))
return
'%s@%s#egg=%s-%s'
%
(
repo
,
tag
,
egg_project_name
,
tag
)
return
'%s@%s#egg=%s-dev'
%
(
repo
,
tip_rev
,
dist
.
egg_name
())
# It's the tip of a branch
full_egg_name
=
'%s-%s'
%
(
dist
.
egg_name
(),
branch_revs
[
current_rev
])
else
:
# Don't know what it is
logger
.
warn
(
'Mercurial URL does not fit normal structure: %s'
%
repo
)
return
'%s@%s#egg=%s-dev'
%
(
repo
,
current_rev
,
egg_project_name
)
full_egg_name
=
'%s-dev'
%
dist
.
egg_name
()
return
'%s@%s#egg=%s'
%
(
repo
,
current_rev_hash
,
full_egg_name
)
vcs
.
register
(
Mercurial
)
...
...
@@ -3527,12 +3505,6 @@ class Bazaar(VersionControl):
[
BZR_CMD
,
'revno'
],
show_stdout
=
False
,
cwd
=
location
)
return
revision
.
splitlines
()[
-
1
]
def
get_newest_revision
(
self
,
location
):
url
=
self
.
get_url
(
location
)
revision
=
call_subprocess
(
[
BZR_CMD
,
'revno'
,
url
],
show_stdout
=
False
,
cwd
=
location
)
return
revision
.
splitlines
()[
-
1
]
def
get_tag_revs
(
self
,
location
):
tags
=
call_subprocess
(
[
BZR_CMD
,
'tags'
],
show_stdout
=
False
,
cwd
=
location
)
...
...
@@ -3554,22 +3526,14 @@ class Bazaar(VersionControl):
return
None
current_rev
=
self
.
get_revision
(
location
)
tag_revs
=
self
.
get_tag_revs
(
location
)
newest_rev
=
self
.
get_newest_revision
(
location
)
if
current_rev
in
tag_revs
:
# It's a tag
, perfect!
# It's a tag
tag
=
tag_revs
.
get
(
current_rev
,
current_rev
)
return
'%s@%s#egg=%s-%s'
%
(
repo
,
tag
,
egg_project_name
,
tag
)
elif
current_rev
==
newest_rev
:
if
find_tags
:
if
current_rev
in
tag_revs
:
tag
=
tag_revs
.
get
(
current_rev
,
current_rev
)
logger
.
notify
(
'Revision %s seems to be equivalent to tag %s'
%
(
current_rev
,
tag
))
return
'%s@%s#egg=%s-%s'
%
(
repo
,
tag
,
egg_project_name
,
tag
)
return
'%s@%s#egg=%s-dev'
%
(
repo
,
newest_rev
,
dist
.
egg_name
())
full_egg_name
=
'%s-%s'
%
(
egg_project_name
,
tag_revs
[
current_rev
])
else
:
# Don't know what it is
logger
.
warn
(
'Bazaar URL does not fit normal structure: %s'
%
repo
)
return
'%s@%s#egg=%s-dev'
%
(
repo
,
current_rev
,
egg_project_name
)
full_egg_name
=
'%s-dev_r%s'
%
(
dist
.
egg_name
(),
current_rev
)
return
'%s@%s#egg=%s'
%
(
repo
,
current_rev
,
full_egg_name
)
vcs
.
register
(
Bazaar
)
...
...
tests/test_freeze.txt
浏览文件 @
3fce1554
...
...
@@ -34,7 +34,7 @@ Now lets try it with an svn checkout::
>>> print result
Script result: ...ython... ../../pip.py -E .../test-scratch freeze
-- stdout: --------------------
-e svn+http://svn.colorstudy.com/INITools/trunk@3472#egg=INITools-0.2.1dev_r3472-py2...-dev
-e svn+http://svn.colorstudy.com/INITools/trunk@3472#egg=INITools-0.2.1dev_r3472-py2...-dev
_r3472
simplejson==1.7.4...
<BLANKLINE>
...
...
@@ -77,23 +77,17 @@ What about a Git clone?::
>>> result = run_pip('freeze', expect_stderr=True)
>>> print result
Script result: ...ython... ../../pip.py -E .../test-scratch freeze
-- stderr: --------------------
Git URL does not fit normal structure: git://github.com/jezdez/django-pagination.git
<BLANKLINE>
-- stdout: --------------------
-e git://github.com/jezdez/django-pagination.git@...#egg=django_pagination-...
...
<BLANKLINE>
>>> result = run_pip('freeze', '-f', 'git://github.com/jezdez/django-pagination.git#egg=django_pagination
-dev
', expect_stderr=True)
>>> result = run_pip('freeze', '-f', 'git://github.com/jezdez/django-pagination.git#egg=django_pagination', expect_stderr=True)
>>> print result
Script result: ...ython... ../../pip.py -E .../test-scratch freeze -f git://github.com/jezdez/django-pagination.git#egg=django_pagination-dev
-- stderr: --------------------
Git URL does not fit normal structure: git://github.com/jezdez/django-pagination.git
<BLANKLINE>
Script result: ...ython... ../../pip.py -E .../test-scratch freeze -f git://github.com/jezdez/django-pagination.git#egg=django_pagination
-- stdout: --------------------
-f git://github.com/jezdez/django-pagination.git#egg=django_pagination
-dev
-e git://github.com/jezdez/django-pagination.git@...#egg=django_pagination-dev
-f git://github.com/jezdez/django-pagination.git#egg=django_pagination
-e git://github.com/jezdez/django-pagination.git@...#egg=django_pagination-
...-
dev
...
<BLANKLINE>
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录