mirror of https://github.com/pypa/pip
Harmonize return type of VersionControl.get_revision in subclasses
Previously, the Subversion subclass violated the parent's type signature by returning an int, but it is now coerced to a str to match the expected signature.
This commit is contained in:
parent
7369ac2ee8
commit
c513c5e890
|
@ -96,6 +96,7 @@ class Bazaar(VersionControl):
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def get_revision(cls, location):
|
def get_revision(cls, location):
|
||||||
|
# type: (str) -> str
|
||||||
revision = cls.run_command(
|
revision = cls.run_command(
|
||||||
['revno'], cwd=location,
|
['revno'], cwd=location,
|
||||||
)
|
)
|
||||||
|
|
|
@ -345,6 +345,7 @@ class Git(VersionControl):
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def get_revision(cls, location, rev=None):
|
def get_revision(cls, location, rev=None):
|
||||||
|
# type: (str, Optional[str]) -> str
|
||||||
if rev is None:
|
if rev is None:
|
||||||
rev = 'HEAD'
|
rev = 'HEAD'
|
||||||
current_rev = cls.run_command(
|
current_rev = cls.run_command(
|
||||||
|
|
|
@ -97,6 +97,7 @@ class Mercurial(VersionControl):
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def get_revision(cls, location):
|
def get_revision(cls, location):
|
||||||
|
# type: (str) -> str
|
||||||
"""
|
"""
|
||||||
Return the repository-local changeset revision number, as an integer.
|
Return the repository-local changeset revision number, as an integer.
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -49,6 +49,7 @@ class Subversion(VersionControl):
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def get_revision(cls, location):
|
def get_revision(cls, location):
|
||||||
|
# type: (str) -> str
|
||||||
"""
|
"""
|
||||||
Return the maximum revision for all files under a given location
|
Return the maximum revision for all files under a given location
|
||||||
"""
|
"""
|
||||||
|
@ -73,7 +74,7 @@ class Subversion(VersionControl):
|
||||||
dirs[:] = []
|
dirs[:] = []
|
||||||
continue # not part of the same svn tree, skip it
|
continue # not part of the same svn tree, skip it
|
||||||
revision = max(revision, localrev)
|
revision = max(revision, localrev)
|
||||||
return revision
|
return str(revision)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def get_netloc_and_auth(cls, netloc, scheme):
|
def get_netloc_and_auth(cls, netloc, scheme):
|
||||||
|
|
Loading…
Reference in New Issue