Recognize PR# at end of commit title for github_pull_request_* templates#881
Closed
bolinfest wants to merge 1 commit into
Closed
Recognize PR# at end of commit title for github_pull_request_* templates#881bolinfest wants to merge 1 commit into
bolinfest wants to merge 1 commit into
Conversation
Summary: On GitHub, commits that are squash/merged from pull requests such as facebook/dotslash@4c0563c commonly have the pull request number at the end of the first line of the commit message like so: ``` Document experimental `fetch` subcommand (facebook#24) ``` This updates the logic for the various `github_pull_request_*` templates to match this pattern. Note this required adding `repo` as an argument to `_parse_github_pull_request_url()` so that it could produce a complete `PullRequestId` object even if it only had the commit number in the commit message. Test Plan: Added a `FakeGitHubRepo` to `testutil.py` to make it easier to write doctests against this new logic. ``` ./tests/run-tests.py ./tests/test-doctest.py ``` I also looked for a repo that doesn't use Meta's tooling (so it doesn't have the `Pull Request resolved` line in its commits) and decided to test with https://github.com/google/generative-ai-docs as follows: ``` $ sl clone https://github.com/google/generative-ai-docs $ cd generative-ai-docs $ /home/mbolin/src/sapling/eden/scm/sl log -T '{node} {github_pull_request_number}\n' --limit 10 d216731f8ab1f2e46da37b62ada121848f1be9e9 375 bc112742515b93e718d9c417203de12fd8786f6a 374 9c91576af5a7b45885ef89858fd3b904501fbb8e 370 45cac496b9a93f4c2251dbe42b0eff71b2a47bc7 360 650a2a48c12ac09a8fe03640f257da6cfac68976 363 576a808e5110dee0d3a9b4456ab8d572c29a8905 359 35e3ae486b2dec7a09952153dda62819a5f4abf2 358 71f9451edc19de37c311906b7f3a689bcacb2bc6 352 da44a67beb8a85bda0e27eb38d5bb8ecec5b26dd 342 955e2842f720fdddb0164d168bc1379470b9b8e9 340 $ /home/mbolin/src/sapling/eden/scm/sl log -T '{node} {github_pull_request_url}\n' --limit 10 d216731f8ab1f2e46da37b62ada121848f1be9e9 https://reviewstack.dev/google/generative-ai-docs/pull/375 bc112742515b93e718d9c417203de12fd8786f6a https://reviewstack.dev/google/generative-ai-docs/pull/374 9c91576af5a7b45885ef89858fd3b904501fbb8e https://reviewstack.dev/google/generative-ai-docs/pull/370 45cac496b9a93f4c2251dbe42b0eff71b2a47bc7 https://reviewstack.dev/google/generative-ai-docs/pull/360 650a2a48c12ac09a8fe03640f257da6cfac68976 https://reviewstack.dev/google/generative-ai-docs/pull/363 576a808e5110dee0d3a9b4456ab8d572c29a8905 https://reviewstack.dev/google/generative-ai-docs/pull/359 35e3ae486b2dec7a09952153dda62819a5f4abf2 https://reviewstack.dev/google/generative-ai-docs/pull/358 71f9451edc19de37c311906b7f3a689bcacb2bc6 https://reviewstack.dev/google/generative-ai-docs/pull/352 da44a67beb8a85bda0e27eb38d5bb8ecec5b26dd https://reviewstack.dev/google/generative-ai-docs/pull/342 955e2842f720fdddb0164d168bc1379470b9b8e9 https://reviewstack.dev/google/generative-ai-docs/pull/340 ```
Contributor
|
@facebook-github-bot has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
Contributor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Recognize PR# at end of commit title for github_pull_request_* templates
Summary:
On GitHub, commits that are squash/merged from pull requests
such as facebook/dotslash@4c0563c
commonly have the pull request number at the end of
the first line of the commit message like so:
This updates the logic for the various
github_pull_request_*templates to match this pattern.
Note this required adding
repoas an argument to_parse_github_pull_request_url()so that it could producea complete
PullRequestIdobject even if it only hadthe commit number in the commit message.
Test Plan:
Added a
FakeGitHubRepototestutil.pyto make it easierto write doctests against this new logic.
I also looked for a repo that doesn't use Meta's tooling
(so it doesn't have the
Pull Request resolvedline in its commits)and decided to test with https://github.com/google/generative-ai-docs as follows: