[llvm-dev] [cfe-dev] Phabricator -> GitHub PRs?

Hubert Tong via llvm-dev llvm-dev at lists.llvm.org
Fri Sep 11 11:31:57 PDT 2020


On Fri, Sep 11, 2020 at 1:39 PM Stephen Neuendorffer via llvm-dev <
llvm-dev at lists.llvm.org> wrote:

> The LLVM incubator projects have been using github PRs for reviews and so
> far haven't really seen any significant issues.  The biggest confusion so
> far has not been with reviews but with the difference between "rebase and
> merge" and "squash and mere".  We have used basically 3 different processes:
>
> Method 1: start a review with one commit on a new branch (typically in a
> personal repository 'fork'). Respond to review comments by adding
> additional commits on the same branch. Then you want to "Squash and
> Merge".   Real life example: https://github.com/llvm/circt/pull/62  Note
> that Github keeps seems to keep a reference to commits where a review
> occurred, but does not necessarily preserve other commits in the chain.
> Also note that you can go back and look at either the final disposition of
> the code on the main page, or view the diff "as reviewed" to understand
> comments in their original context.
>
My understanding is this workflow is reliable. The other commits in the
chain are reachable, because GitHub allows the PR branch prior to the
"Squash and Merge" to be restored as long as people are not reusing PR
branches.

Method 2: start a review as a sequence of commits. Respond to review
> comments by updating your sequence of commits rebasing locally and git push
> -f to update your branch with a new set of commits. The sequence of commits
> is preserved using 'rebase and merge'.  Real life example:
>
This is likely to lose the context of comments as time/activity progresses.
My understanding is that very strict discipline by the developer is needed
in addressing inline comments under such a workflow, because inline
comments are not handled well by GitHub under this model.


>  Method 3: start a review with one commit, respond to review comments with
> git commit --amend on the commit. git push -f to update your branch. In
> this case, only one commit is being merged, so 'rebase and merge' and
> 'squash and merge'.  Real life example:
> https://github.com/llvm/circt/pull/63
>
All of my comments on Method 2 (above) also apply to Method 3.


> Some projects attempt to simplify the options and only allow "squash and
> merge" as an option.  This eliminates Method 2, but also prevents mistakes
> where people intend to use Method 1, but accidently select "Rebase and
> merge".  This results in undesired commit history littered with a bunch of
> meaningless commits like "Fix typo.", "Address comments." etc  Method 2 is
> generally harder to review and discouraged, but seems sometimes necessary
> when you have dependent commits that are logically separate but need to be
> reviewed together to make sense.
>
Method 2 could be handled in Phabricator as a patch series. The general
difficulty in reviewing individual commits is a GitHub problem.


> There seems to be a split between those who prefer to curate commits
> locally and present them in the PR (i.e. Method 3) as they are to be
> committed (i.e. squash/amend/etc from my workstation and push the result),
> and those who seem to feel that it is better to avoid "git rebase" and "git
> commit --amend" and let github handle rewriting the history with the commit.
>
Are these primarily developers or reviewers with these preferences? Are the
people using Method 3 handling inline comments diligently? Is GitHub still
"great" if Method 1 is the model with the least surprises?


>
> Steve
>
>
>
> On Wed, Jan 29, 2020 at 12:56 AM Nicolai Hähnle via llvm-dev <
> llvm-dev at lists.llvm.org> wrote:
>
>> On Tue, Jan 28, 2020 at 2:23 PM Renato Golin <rengolin at gmail.com> wrote:
>> > On Tue, 28 Jan 2020 at 12:28, Nicolai Hähnle <nhaehnle at gmail.com>
>> wrote:
>> > > I don't quite follow. Yes, gratuitous useless changes tend to create
>> > > merge and rebase problems and should generally be avoided. Why does it
>> > > make a difference whether they're in multiple commits though?
>> >
>> > I think you misunderstood.
>> >
>> > Our policy [1] is that independent NFC fixups on existing code should
>> > be separate from new changes.
>> >
>> > The point here is that fixups *to the patch* should be squashed into
>> > their original commits *before* merging.
>>
>> Okay, this intention wasn't clear to me from what was written. It
>> looks like we agree, then.
>>
>>
>>
>> > Once the patches are in master, and problems have been found, then
>> > adding a fixup to master is totally fine.
>> >
>> > We don't want to rewrite history on master, that'd be a nightmare. If
>> > something is botched, we revert, then reapply.
>> >
>> > We also don't want to have fixups to things that haven't landed on
>> > master yet, so cleaning up the patches and series before merging is
>> > highly encouraged.
>> >
>> > But during the review, rewriting history of the series itself makes it
>> > hard for any review tool to have meaningful representations.
>>
>> This isn't quite true, as others already pointed out, and *not*
>> rewriting history can make reviews harder as well! In fact, I've *just
>> now* had that happen to me on another GitHub project, where this
>> sequence of events happened:
>>
>> 1. PR was opened with a series of commits, one of which (call it
>> commit B for base) is non-trivial and under review separately as a
>> different PR.
>> 2. Other reviewer makes comments, asks for some refactoring changes.
>> 3. Author makes those changes, adds them as a fixup commit.
>> 4. I can now no longer usefully review the PR, because I only have two
>> options, both of which are similarly useless:
>> 4a. I look at all changes in the PR, in which case I get a messy
>> mixture of commit B (which ought to be reviewed separately) and the
>> rest.
>> 4b. I look at individual commits in the PR, but then I only see a
>> stale version of the author's work.
>>
>> The fixup approach *might* work if there is only a single reviewer,
>> but even then I suspect things can quickly become messy. And in any
>> case, the default assumption in LLVM should be that anybody can join a
>> review at any time.
>>
>> The one tool that actually gets this right is Gerrit, which
>> understands commit series *and* allows you to diff between versions of
>> a commit. It's unfortunate that Gerrit is so ugly that most people
>> won't even look at it (and it does have other weaknesses as well,
>> admittedly).
>>
>> Cheers,
>> Nicolai
>>
>>
>>
>> > So, it's better to have separate fixups during review, but we really
>> > should squash them into their related commits in the series before
>> > pushing.
>> >
>> > --renato
>> >
>> > [1] http://llvm.org/docs/DeveloperPolicy.html
>>
>>
>>
>> --
>> Lerne, wie die Welt wirklich ist,
>> aber vergiss niemals, wie sie sein sollte.
>> _______________________________________________
>> LLVM Developers mailing list
>> llvm-dev at lists.llvm.org
>> https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
>>
> _______________________________________________
> LLVM Developers mailing list
> llvm-dev at lists.llvm.org
> https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20200911/01a4798b/attachment-0001.html>


More information about the llvm-dev mailing list