-
Notifications
You must be signed in to change notification settings - Fork 285
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
Optionally limit the number of PRs created in each submission #824
Conversation
Currently, when submitting a PR in Sapling, it's easy to accidentally create multiple PRs when only one was intended (e.g. forgetting to run `sl pr follow`, or editing a PR that is based off a different branch). With this change, you can configure Sapling to limit the number of PRs that can be created in a single submit action, e.g. to just 1: ``` sl config --user github.max-prs-to-create=1 ``` Now when attempting to create multiple PRs in a single `sl pr submit` action, Sapling will fail with: ``` abort: refused to create 2 pull requests, max is 1 ```
@facebook-github-bot has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As a follow up to this commit, I'd suggest adding a default limit of maybe 10, and update the error message to instruct users how to override it.
_("refused to create %d pull requests, max is %d") | ||
% (len(params.pull_requests_to_create), max_pull_requests_to_create) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit:
_("refused to create %d pull requests, max is %d") | |
% (len(params.pull_requests_to_create), max_pull_requests_to_create) | |
_("refused to create %d pull requests, max is %d\nif you want to open %d pull requests, run again with `--config github.max-prs-to-create=-1") | |
% (len(params.pull_requests_to_create), max_pull_requests_to_create, len(params.pull_requests_to_create) ) | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the suggestion!
I've updated the PR, and (following our discussion on Discord) set the default value to 5.
Still open to further feedback of course.
Also update error message to explain how to create more than 5 PRs in one command.
@rejc2 has updated the pull request. You must reimport the pull request before landing. |
@facebook-github-bot has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
❤️
This pull request has been merged in e62f3e8. |
Optionally limit the number of PRs created in each submission
Currently, when submitting a PR in Sapling, it's easy to accidentally create multiple PRs when only one was intended (e.g. forgetting to run
sl pr follow
, or editing a PR that is based off a different branch).With this change, you can configure Sapling to limit the number of PRs that can be created in a single submit action, e.g. to just 1:
Now when attempting to create multiple PRs in a single
sl pr submit
action, Sapling will fail with:(Note that this setting doesn't limit the size of a PR stack: a larger PR stack can be made by submitting each new PR separately. Re-submitting the top PR will still update the entire stack below it, no matter the size.)
Based on feedback and discussion, I've set the default for
github.max-prs-to-create
to be 5.