homu icon indicating copy to clipboard operation
homu copied to clipboard

[rfc] command to squash and merge

Open sourcefrog opened this issue 8 years ago • 11 comments

It is common in the rust repo for at least small changes that reviewers ask the contributor to squash the changes before they're merged. (For example https://github.com/rust-lang/rust/pull/38158#issuecomment-266308467.)

To avoid another round-trip to the contributor, perhaps Bors/Homu could be given a command to squash and merge, ie to do git commit --merge?

Looking at the code there seems to be a per-repo option for autosquash but Rust might want it to be per-PR.

sourcefrog avatar Dec 13 '16 22:12 sourcefrog

What would be the commit message?

nox avatar Dec 13 '16 22:12 nox

FTR, we've been actually thinking of squashing PRs ourselves ever since maintainers gained the ability to push to/pull from PR branches.

KiChjang avatar Dec 13 '16 22:12 KiChjang

What would be the commit message?

I guess it would be the PR title, but perhaps it could be included in the command to Bors?

sourcefrog avatar Dec 13 '16 22:12 sourcefrog

This also means that the PR won't get marked as merged unless homu first pushes the squashed version to the PR.

Manishearth avatar Dec 13 '16 22:12 Manishearth

True, which it probably cannot do when the PR is coming from a third party. However it could mark it as closed, and the author would presumably see the new commits in their name in their activity.

sourcefrog avatar Dec 13 '16 22:12 sourcefrog

Would it work for Homu to tell Github to do the merge (https://developer.github.com/v3/pulls/#merge-a-pull-request-merge-button)? There is a squash option there.

sourcefrog avatar Dec 13 '16 22:12 sourcefrog

I ... guess. That's pretty incompatible with the current architecture. If github gave you a way of fetching the "post squash merge commit" that would be nice.

Then again, we already have support for rebasing (which just doesn't mark the PR as merged)

Manishearth avatar Dec 13 '16 23:12 Manishearth

A PR title isn't always a good commit message.

nox avatar Dec 14 '16 01:12 nox

We've also had cases of multi-author PRs, where we decided not to squash everything in order to preserve authorship.

asajeffrey avatar Dec 14 '16 01:12 asajeffrey

I'm not suggesting it should always squash. Just that, when the reviewer wants it squashed, Homu could do this, as a human reviewer would, rather than making the contributor do it.

For new contributors it saves them getting into more complicated git commands: everything up to this point you could do entirely through the github web UI.

And even for experienced users, it would save to find trips.

On Tue, Dec 13, 2016, 5:59 PM Alan Jeffrey [email protected] wrote:

We've also had cases of multi-author PRs, where we decided not to squash everything in order to preserve authorship.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/servo/homu/issues/70#issuecomment-266920670, or mute the thread https://github.com/notifications/unsubscribe-auth/AAVI8wQ_1qKjCj0IDG7Oudj0KU6bGV-Lks5rH02HgaJpZM4LMULf .

sourcefrog avatar Dec 14 '16 02:12 sourcefrog

Yes, having an option to automate "squash and r=me" would be nice, since we do it a lot.

asajeffrey avatar Dec 14 '16 02:12 asajeffrey