Skip to content

Commit 04a966b

Browse files
committed
Fix base branch key in guess_pr()
Fix a dormant bug in guess_pr(): wrong base branch key has been used for lookup of synced PRs. Apparently this code path almost never executed until e28008d, which removed another level of "cache" with lookup by name. Differential Revision: D79693152 Reviewed-by: Jordan Rome <[email protected]> Signed-off-by: Ihor Solodrai <[email protected]>
1 parent e28008d commit 04a966b

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

kernel_patches_daemon/branch_worker.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -774,7 +774,7 @@ async def _guess_pr(
774774

775775
try:
776776
# we assuming only one PR can be active for one head->base
777-
return self.all_prs[branch][self.repo_branch][0]
777+
return self.all_prs[branch][self.repo_pr_base_branch][0]
778778
except (KeyError, IndexError):
779779
pass
780780

tests/test_branch_worker.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -644,7 +644,7 @@ async def test_guess_pr_return_from_secondary_cache_with_specified_branch(
644644
series = Series(self._pw, SERIES_DATA)
645645
sentinel = random.random()
646646
self._bw.all_prs[mybranch] = {}
647-
self._bw.all_prs[mybranch][TEST_REPO_BRANCH] = [sentinel]
647+
self._bw.all_prs[mybranch][TEST_REPO_PR_BASE_BRANCH] = [sentinel]
648648
pr = await self._bw._guess_pr(series, mybranch)
649649
self.assertEqual(sentinel, pr)
650650

@@ -661,7 +661,7 @@ async def test_guess_pr_return_from_secondary_cache_without_specified_branch(
661661

662662
sentinel = random.random()
663663
self._bw.all_prs[mybranch] = {}
664-
self._bw.all_prs[mybranch][TEST_REPO_BRANCH] = [sentinel]
664+
self._bw.all_prs[mybranch][TEST_REPO_PR_BASE_BRANCH] = [sentinel]
665665
pr = await self._bw._guess_pr(series, mybranch)
666666
self.assertEqual(sentinel, pr)
667667

0 commit comments

Comments
 (0)