Skip to content

Commit

Permalink
gitpoller: fix _process_changes to only list commit from tracked branch
Browse files Browse the repository at this point in the history
On non-fast-forward merges, only the merge commit should be listed.
  • Loading branch information
tdesveaux committed Jul 7, 2024
1 parent ae85cac commit 5f97396
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 17 deletions.
2 changes: 1 addition & 1 deletion master/buildbot/changes/gitpoller.py
Original file line number Diff line number Diff line change
Expand Up @@ -489,7 +489,7 @@ def _process_changes(self, newRev, branch):

# get the change list
revListArgs = (
['--ignore-missing']
['--ignore-missing', '--first-parent']
+ ['--format=%H', f'{newRev}']
+ ['^' + rev for rev in sorted(self.lastRev.values())]
+ ['--']
Expand Down
35 changes: 19 additions & 16 deletions master/buildbot/test/unit/changes/test_gitpoller.py
Original file line number Diff line number Diff line change
Expand Up @@ -405,6 +405,7 @@ def test_poll_failLog(self):
'git',
'log',
'--ignore-missing',
'--first-parent',
'--format=%H',
'4423cdbcbb89c14e50dd5f4152415afd686c5241',
'^fa3ae8ed68e664d4db24798611b352e3c6509930',
Expand Down Expand Up @@ -488,6 +489,7 @@ def test_poll_nothingNew(self):
'git',
'log',
'--ignore-missing',
'--first-parent',
'--format=%H',
'4423cdbcbb89c14e50dd5f4152415afd686c5241',
'^4423cdbcbb89c14e50dd5f4152415afd686c5241',
Expand Down Expand Up @@ -598,6 +600,7 @@ def test_poll_multipleBranches(self):
'git',
'log',
'--ignore-missing',
'--first-parent',
'--format=%H',
'4423cdbcbb89c14e50dd5f4152415afd686c5241',
'^bf0b01df6d00ae8d1ffa0b2e2acbe642a6cd35d5',
Expand All @@ -622,6 +625,7 @@ def test_poll_multipleBranches(self):
'git',
'log',
'--ignore-missing',
'--first-parent',
'--format=%H',
'9118f4ab71963d23d02d4bdc54876ac8bf05acf2',
'^4423cdbcbb89c14e50dd5f4152415afd686c5241',
Expand Down Expand Up @@ -759,6 +763,7 @@ def test_poll_multipleBranches_buildPushesWithNoCommits_default(self):
'git',
'log',
'--ignore-missing',
'--first-parent',
'--format=%H',
'4423cdbcbb89c14e50dd5f4152415afd686c5241',
'^4423cdbcbb89c14e50dd5f4152415afd686c5241',
Expand Down Expand Up @@ -811,6 +816,7 @@ def test_poll_multipleBranches_buildPushesWithNoCommits_true(self):
'git',
'log',
'--ignore-missing',
'--first-parent',
'--format=%H',
'4423cdbcbb89c14e50dd5f4152415afd686c5241',
'^4423cdbcbb89c14e50dd5f4152415afd686c5241',
Expand Down Expand Up @@ -910,6 +916,7 @@ def test_poll_multipleBranches_buildPushesWithNoCommits_true_fast_forward(self):
'git',
'log',
'--ignore-missing',
'--first-parent',
'--format=%H',
'4423cdbcbb89c14e50dd5f4152415afd686c5241',
'^0ba9d553b7217ab4bbad89ad56dc0332c7d57a8c',
Expand Down Expand Up @@ -1013,6 +1020,7 @@ def test_poll_multipleBranches_buildPushesWithNoCommits_true_not_tip(self):
'git',
'log',
'--ignore-missing',
'--first-parent',
'--format=%H',
'4423cdbcbb89c14e50dd5f4152415afd686c5241',
'^0ba9d553b7217ab4bbad89ad56dc0332c7d57a8c',
Expand Down Expand Up @@ -1108,6 +1116,7 @@ def test_poll_allBranches_single(self):
'git',
'log',
'--ignore-missing',
'--first-parent',
'--format=%H',
'4423cdbcbb89c14e50dd5f4152415afd686c5241',
'^fa3ae8ed68e664d4db24798611b352e3c6509930',
Expand Down Expand Up @@ -1218,6 +1227,7 @@ def test_poll_noChanges(self):
'git',
'log',
'--ignore-missing',
'--first-parent',
'--format=%H',
'4423cdbcbb89c14e50dd5f4152415afd686c5241',
'^4423cdbcbb89c14e50dd5f4152415afd686c5241',
Expand Down Expand Up @@ -1265,6 +1275,7 @@ def test_poll_allBranches_multiple(self):
'git',
'log',
'--ignore-missing',
'--first-parent',
'--format=%H',
'4423cdbcbb89c14e50dd5f4152415afd686c5241',
'^bf0b01df6d00ae8d1ffa0b2e2acbe642a6cd35d5',
Expand All @@ -1289,6 +1300,7 @@ def test_poll_allBranches_multiple(self):
'git',
'log',
'--ignore-missing',
'--first-parent',
'--format=%H',
'9118f4ab71963d23d02d4bdc54876ac8bf05acf2',
'^4423cdbcbb89c14e50dd5f4152415afd686c5241',
Expand Down Expand Up @@ -1396,6 +1408,7 @@ def test_poll_callableFilteredBranches(self):
'git',
'log',
'--ignore-missing',
'--first-parent',
'--format=%H',
'4423cdbcbb89c14e50dd5f4152415afd686c5241',
'^bf0b01df6d00ae8d1ffa0b2e2acbe642a6cd35d5',
Expand Down Expand Up @@ -1507,6 +1520,7 @@ def test_poll_branchFilter(self):
'git',
'log',
'--ignore-missing',
'--first-parent',
'--format=%H',
'9118f4ab71963d23d02d4bdc54876ac8bf05acf2',
'^bf0b01df6d00ae8d1ffa0b2e2acbe642a6cd35d5',
Expand Down Expand Up @@ -1613,6 +1627,7 @@ def test_poll_old(self):
'git',
'log',
'--ignore-missing',
'--first-parent',
'--format=%H',
'4423cdbcbb89c14e50dd5f4152415afd686c5241',
'^fa3ae8ed68e664d4db24798611b352e3c6509930',
Expand Down Expand Up @@ -1727,6 +1742,7 @@ def test_poll_callableCategory(self):
'git',
'log',
'--ignore-missing',
'--first-parent',
'--format=%H',
'4423cdbcbb89c14e50dd5f4152415afd686c5241',
'^fa3ae8ed68e664d4db24798611b352e3c6509930',
Expand Down Expand Up @@ -1851,6 +1867,7 @@ def test_startService_loadLastRev(self):
'git',
'log',
'--ignore-missing',
'--first-parent',
'--format=%H',
'fa3ae8ed68e664d4db24798611b352e3c6509930',
'^fa3ae8ed68e664d4db24798611b352e3c6509930',
Expand Down Expand Up @@ -1961,6 +1978,7 @@ async def test_poll_found_head(self):
'git',
'log',
'--ignore-missing',
'--first-parent',
'--format=%H',
'737b94eca1ddde3dd4a0040b25c8a25fe973fe09',
'^4423cdbcbb89c14e50dd5f4152415afd686c5241',
Expand Down Expand Up @@ -2011,6 +2029,7 @@ async def test_poll_found_head_not_found(self):
'git',
'log',
'--ignore-missing',
'--first-parent',
'--format=%H',
'737b94eca1ddde3dd4a0040b25c8a25fe973fe09',
'^4423cdbcbb89c14e50dd5f4152415afd686c5241',
Expand Down Expand Up @@ -2675,22 +2694,6 @@ async def test_poll_from_last(self):
'src': 'git',
'when_timestamp': 1717855320,
},
{
'author': 'test user <[email protected]>',
'branch': 'main',
'category': None,
'codebase': None,
'comments': 'Feature 1',
'committer': 'test user <[email protected]>',
'files': ['README.md'],
'project': '',
'properties': {},
'repository': self.repo_url,
'revision': self.FEATURE_1_SHA,
'revlink': '',
'src': 'git',
'when_timestamp': 1717855380,
},
{
'author': 'test user <[email protected]>',
'branch': 'main',
Expand Down

0 comments on commit 5f97396

Please sign in to comment.