-
-
Notifications
You must be signed in to change notification settings - Fork 10.1k
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
pr-pull: implement autosquash option #8724
Conversation
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.
Looks pretty good and a nice idea. Might be nice to split out some logic to make it more testable and add some tests.
Library/Homebrew/dev-cmd/pr-pull.rb
Outdated
Formulary.from_contents(formula_name, full_path, old_file, :stable) | ||
rescue FormulaUnavailableError | ||
nil | ||
end |
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.
Formulary.from_contents(formula_name, full_path, old_file, :stable) | |
rescue FormulaUnavailableError | |
nil | |
end | |
Formulary.from_contents(formula_name, full_path, old_file, :stable) | |
rescue FormulaUnavailableError | |
nil | |
end |
and same below
Library/Homebrew/dev-cmd/pr-pull.rb
Outdated
return "#{formula_name} #{new_formula.stable.version}" if old_formula.stable.version != new_formula.stable.version | ||
return "#{formula_name}: revision #{reason}" if old_formula.revision != new_formula.revision | ||
|
||
"#{formula_name}: #{reason || "rebuild"}" |
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.
might be nice to split the reason
or rebuild
case into an early return like the above.
cherry_pick_pr!(pr, path: tap.path, args: args) | ||
autosquash!(original_commit, path: tap.path, args: args) if args.autosquash? | ||
signoff!(pr, tap: tap, args: args) unless args.clean? |
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.
I wonder if these three functions could all split off into other files with unit tests. Just aware that this file is getting pretty long, only likely to get longer and has essentially no testing.
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.
Yeah, I'm thinking of maybe moving into utils/git.rb
. Have split some stuff off into their own functions and thinking about how I can do tests.
I've split another branch off with the refactoring and test improvements, so gonna merge this in for now and work on the refactor so this pull request doesn't get huge. |
brew style
with your changes locally?brew tests
with your changes locally?Step 1 of #8093.
Maintainers should be able to run e.g.
brew pr-pull --autosquash 1234
and automagically get a reasonable-looking commit message. Still have some testing to do with pull requests with multiple authors and other edge cases but I'd like to get this feature out for review before I neglect it even more.Simple version bump:
New formula:
Rewording a commit: