Merge "Keep scanning master branch after first shared commit"

This commit is contained in:
Zuul 2020-04-27 19:24:18 +00:00 committed by Gerrit Code Review
commit 10dde3f410
3 changed files with 28 additions and 9 deletions

View File

@ -0,0 +1,10 @@
---
features:
- |
If no earliest version is provided for a branch, reno will scan commits
on the branch in reverse order, attempting to find a common ancestor
with the master branch. Once found, the last common commit - the branch
point - is checked for a tag. Previously, if no tag was found, reno
would stop scanning. This was problematic for instances where a branch
was not created at the tagged commit but rather some commits later.
Reno will now continue scanning until it finds a tag.

View File

@ -660,13 +660,13 @@ class Scanner(object):
c.commit.sha().hexdigest().encode('ascii'))
if tags:
return tags[-1]
else:
# Naughty, naughty, branching without tagging.
LOG.info(
('There is no tag on commit %s at the base of %s. '
'Branch scan short-cutting is disabled.'),
c.commit.sha().hexdigest(), branch)
return None
# Naughty, naughty, branching without tagging.
LOG.info(
'There is no tag on commit %s at the base of %s. '
'Branch scan short-cutting is disabled.',
c.commit.sha().hexdigest(), branch,
)
return None
def _topo_traversal(self, branch):

View File

@ -1269,10 +1269,19 @@ class BranchBaseTest(Base):
self.repo.git('tag', '-d', '2.0.0')
self._add_notes_file('slug4')
self.repo.git('checkout', 'master')
self.assertIsNone(
self.scanner._get_branch_base('not-master')
self.assertEqual(
'1.0.0',
self.scanner._get_branch_base('not-master'),
)
def test_no_tags(self):
# remove all tags from before the branch
self.repo.git('tag', '-d', '2.0.0')
self.repo.git('tag', '-d', '1.0.0')
self._add_notes_file('slug4')
self.repo.git('checkout', 'master')
self.assertIsNone(self.scanner._get_branch_base('not-master'))
class BranchTest(Base):