Commits


Fiona La authored and David Li committed 919d1138832
ARROW-13564: [Dev] Check individual commit messages for "Co-authored-by:" tags when integrating a pull request ## Overview The goal of this pull request is to add functionality to `dev/merge_arrow_pr.py`, that checks individual commit messages for `Co-authored-by:` tags, when creating the squashed commit message when merging a pull request. This will ensure that all authors are included in the final commit message, to make sure they are acknowledged for their contributions. ## Implementation 1. Use the [`trailers`](https://git-scm.com/docs/git-log#Documentation/git-log.txt-emtrailersoptionsem) options of `git log` to check for the [`Co-authored-by` trailer](https://docs.github.com/en/pull-requests/committing-changes-to-your-project/creating-and-editing-commits/creating-a-commit-with-multiple-authors). The equivalent `git` command is: `git log HEAD..<pull-request-branch> --pretty="%(trailers:key=Co-authored-by,valueonly)"` 2. For each commit in `<pull-request-branch>`, this command prints the value of any `Co-authored-by` trailers, which should be in the form of `<name> <<email-address>>`. 3. The values returned by this command are appended to the list of all commit authors. 4. Added a comment to set `PR_REMOTE_NAME` if the user has not set a remote named `apache` to `git@github.com:apache/arrow.git`. ## Testing I qualified the changes to `merge_arrow_pr.py` by taking the the following steps: 1. Created a branch for this change, [ARROW-13564](https://github.com/mathworks/arrow/tree/ARROW-13564) and corresponding [pull request](https://github.com/apache/arrow/pull/12693). 2. Add a [commit](https://github.com/apache/arrow/pull/12693/commits/defab97167af14295465e052cabf65bc39deec59) that has multiple Co-authors. 3. Set the following environment variables: - `DEBUG 1` - `PR_REMOTE_NAME upstream` (my remote to `git@github.com:apache/arrow.git` is named `upstream`) 5. Run the merge script, `merge_arrow_pr.py`, following the usage text. 6. The output from the merge script: ``` -m Closes #12693 from lafiona/ARROW-13564 -m Lead-authored-by: Fiona La <fionala@mathworks.com> Co-authored-by: Fiona La <fionala7@gmail.com> Co-authored-by: Kevin Gurney <kgurney@mathworks.com> Signed-off-by: Fiona La <fionala@mathworks.com> Merge complete (local ref PR_TOOL_MERGE_PR_12693_MASTER). Push to upstream? (y/n): n ``` ## Notes Thank you @kevingurney and @lidavidm for your help with this pull request! Closes #12693 from lafiona/ARROW-13564 Lead-authored-by: Fiona La <fionala@mathworks.com> Co-authored-by: Fiona La <fionala7@gmail.com> Co-authored-by: Kevin Gurney <kgurney@mathworks.com> Signed-off-by: David Li <li.davidm96@gmail.com>