mirror of
https://github.com/pypa/pip
synced 2023-12-13 21:30:23 +01:00
Fix issue #1083.
This commit escapes the egg "surname" when using git with freeze.
This commit is contained in:
parent
9ffa90fb5d
commit
b88207a36f
|
@ -119,6 +119,12 @@ class VersionControl(object):
|
|||
self._cmd = command
|
||||
return command
|
||||
|
||||
# See issue #1083 for why this method was introduced:
|
||||
# https://github.com/pypa/pip/issues/1083
|
||||
def escape_egg_surname(self, surname):
|
||||
# For example, Django has branches of the form "stable/1.7.x".
|
||||
return surname.replace('/', '_')
|
||||
|
||||
def get_url_rev(self):
|
||||
"""
|
||||
Returns the correct repository URL and revision by parsing the given
|
||||
|
|
|
@ -177,8 +177,9 @@ class Git(VersionControl):
|
|||
|
||||
if current_rev in names_by_commit:
|
||||
# It's a tag
|
||||
name = names_by_commit[current_rev]
|
||||
full_egg_name = (
|
||||
'%s-%s' % (egg_project_name, names_by_commit[current_rev])
|
||||
'%s-%s' % (egg_project_name, self.escape_egg_surname(name))
|
||||
)
|
||||
else:
|
||||
full_egg_name = '%s-dev' % egg_project_name
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
from tests.lib import pyversion
|
||||
from pip.vcs import VersionControl
|
||||
from pip.vcs.bazaar import Bazaar
|
||||
from pip.vcs.git import Git
|
||||
from mock import Mock
|
||||
|
@ -38,6 +39,13 @@ def test_git_get_src_requirements():
|
|||
])
|
||||
|
||||
|
||||
def test_escape_egg_surname():
|
||||
vc = VersionControl()
|
||||
assert vc.escape_egg_surname("foo") == "foo"
|
||||
assert vc.escape_egg_surname("foo/bar") == "foo_bar"
|
||||
assert vc.escape_egg_surname("foo/1.2.3") == "foo_1.2.3"
|
||||
|
||||
|
||||
def test_bazaar_simple_urls():
|
||||
"""
|
||||
Test bzr url support.
|
||||
|
|
Loading…
Reference in a new issue