Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle missing __DEFAULT__ branch gracefully #38

Closed

Conversation

liu-song-6
Copy link
Contributor

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.

@facebook-github-bot
Copy link
Contributor

@facebook-github-bot has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

Comment on lines 122 to 125
try:
mapped_branches = self.tag_to_branch_mapping["__DEFAULT__"]
except KeyError:
return []
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can use dict.get(key, default), e.g:

mapped_branches = self.tag_to_branch_mapping.get("DEFAULT", [])

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]>
@liu-song-6 liu-song-6 force-pushed the no-default-branch branch from 1e732a2 to 725834c Compare May 14, 2024 23:32
@facebook-github-bot
Copy link
Contributor

@chantra has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

@facebook-github-bot
Copy link
Contributor

@chantra merged this pull request in 1dee355.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants