Skip to content

Commit

Permalink
Handle missing __DEFAULT__ branch gracefully
Browse files Browse the repository at this point in the history
There are cases that we don't want to do PR for patches without a mapped
branch. IOW, there is no "__DEFAULT__" branch. Handle such cases
gracefully.

Signed-off-by: Song Liu <[email protected]>
  • Loading branch information
liu-song-6 committed May 14, 2024
1 parent e890777 commit 725834c
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion kernel_patches_daemon/github_sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ async def get_mapped_branches(self, series: Series) -> List[str]:
logging.info(f"Tag '{tag}' mapped to branch order {mapped_branches}")
return mapped_branches

mapped_branches = self.tag_to_branch_mapping["__DEFAULT__"]
mapped_branches = self.tag_to_branch_mapping.get("__DEFAULT__", [])
logging.info(f"Mapped to default branch order: {mapped_branches}")
return mapped_branches

Expand Down Expand Up @@ -199,6 +199,11 @@ async def sync_patches(self) -> None:

mapped_branches = await self.get_mapped_branches(series)
# series to apply - last known series
if len(mapped_branches) == 0:
logging.info(
f"Skipping {series.id}: {subject.subject} for no mapped branches."
)
continue
last_branch = mapped_branches[-1]
for branch in mapped_branches:
worker = self.workers[branch]
Expand Down

0 comments on commit 725834c

Please sign in to comment.