centralize handling of branches without base tags
Move the logic for handling an empty earliest_version value to the place where that value is used to find the scanning stop point so that all entries into that code path are protected from bad input data. Change-Id: Id54f8d48dd5dff6c6744c128a258d335a4586e6b Closes-Bug: #1652178 Signed-off-by: Doug Hellmann <doug@doughellmann.com>
This commit is contained in:
@@ -527,6 +527,8 @@ class Scanner(object):
|
||||
is used, regardless of its version.
|
||||
|
||||
"""
|
||||
if not earliest_version:
|
||||
return None
|
||||
earliest_parts = _parse_version(earliest_version)
|
||||
try:
|
||||
idx = versions_by_date.index(earliest_version) + 1
|
||||
@@ -581,11 +583,8 @@ class Scanner(object):
|
||||
|
||||
# If the user has told us where to stop, use that as the
|
||||
# default.
|
||||
if earliest_version:
|
||||
scan_stop_tag = self._find_scan_stop_point(
|
||||
earliest_version, versions_by_date, collapse_pre_releases)
|
||||
else:
|
||||
scan_stop_tag = None
|
||||
scan_stop_tag = self._find_scan_stop_point(
|
||||
earliest_version, versions_by_date, collapse_pre_releases)
|
||||
|
||||
# If the user has not told us where to stop, try to work it
|
||||
# out for ourselves. If branch is set and is not "master",
|
||||
|
||||
@@ -1289,6 +1289,12 @@ class ScanStopPointTest(Base):
|
||||
'not.a.numeric.version', [], True),
|
||||
)
|
||||
|
||||
def test_none(self):
|
||||
self.assertIsNone(
|
||||
self.scanner._find_scan_stop_point(
|
||||
None, [], True),
|
||||
)
|
||||
|
||||
def test_unknown_version(self):
|
||||
self.assertIsNone(
|
||||
self.scanner._find_scan_stop_point(
|
||||
|
||||
Reference in New Issue
Block a user