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:
Jon Dufresne 2020-12-30 10:08:12 -08:00
parent 7369ac2ee8
commit c513c5e890
5 changed files with 5 additions and 1 deletions

View File

@ -96,6 +96,7 @@ class Bazaar(VersionControl):
@classmethod
def get_revision(cls, location):
# type: (str) -> str
revision = cls.run_command(
['revno'], cwd=location,
)

View File

@ -345,6 +345,7 @@ class Git(VersionControl):
@classmethod
def get_revision(cls, location, rev=None):
# type: (str, Optional[str]) -> str
if rev is None:
rev = 'HEAD'
current_rev = cls.run_command(

View File

@ -97,6 +97,7 @@ class Mercurial(VersionControl):
@classmethod
def get_revision(cls, location):
# type: (str) -> str
"""
Return the repository-local changeset revision number, as an integer.
"""

View File

@ -49,6 +49,7 @@ class Subversion(VersionControl):
@classmethod
def get_revision(cls, location):
# type: (str) -> str
"""
Return the maximum revision for all files under a given location
"""
@ -73,7 +74,7 @@ class Subversion(VersionControl):
dirs[:] = []
continue # not part of the same svn tree, skip it
revision = max(revision, localrev)
return revision
return str(revision)
@classmethod
def get_netloc_and_auth(cls, netloc, scheme):