fix the logic for deciding what to show as the "current" series

Stop at the first version after the most recent branch was created,
instead of always only showing the most current version.

Change-Id: I58326c9e30349d2d7c473558b9aa2e8f7294c652
Closes-Bug: #1682147
Signed-off-by: Doug Hellmann <doug@doughellmann.com>
This commit is contained in:
Doug Hellmann 2017-05-24 15:44:20 -04:00
parent 2d0d05d301
commit e2d60c0793
2 changed files with 13 additions and 2 deletions

View File

@ -887,7 +887,16 @@ class Scanner(object):
LOG.debug('looking at base of %s to stop scanning master',
branches[-1])
scan_stop_tag = self._get_branch_base(branches[-1])
earliest_version = current_version
# If there is a tag on this branch after the point
# where the earlier branch was created, then use that
# tag as the earliest version to show in the current
# "series". If there is no such tag, then go all the
# way to the base of that earlier branch.
try:
idx = versions_by_date.index(scan_stop_tag) + 1
earliest_version = versions_by_date[idx]
except IndexError:
earliest_version = scan_stop_tag
elif branch and stop_at_branch_base and not earliest_version:
# If branch is set and is not "master",
# then we want to stop at the version before the tag at the

View File

@ -612,7 +612,7 @@ class BasicTest(Base):
self.repo.git('tag', '-s', '-m', 'first tag', '1.0.0')
self._add_notes_file()
self.repo.git('tag', '-s', '-m', 'middle tag', '2.0.0')
self._add_notes_file()
f3 = self._add_notes_file()
self.repo.git('tag', '-s', '-m', 'last tag', '3.0.0')
self.repo.git('branch', 'stable/a')
f4 = self._add_notes_file()
@ -627,6 +627,7 @@ class BasicTest(Base):
}
self.assertEqual(
{'3.0.0-1': [f4],
'3.0.0': [f3],
},
results,
)
@ -1112,6 +1113,7 @@ class BranchTest(Base):
self.assertEqual(
{
'2.0.0-1': [f21],
'2.0.0': [self.f2],
},
results,
)