- Change Summary:
-
Added a fix for closing private review requests.
- Description:
-
This is the initial implementation of the GitHub post-receive hook that will automatically close review requests as "submitted" after a push. To determine which review requests should be closed, it scans through each commit's commit message for the following strings (case-insensitive): "Reviewed at <reviewboard_url>/r/<id>" or "Review request #<id>".
It currently works for simple use cases (pushing a commit that references /r/<id> automatically closes that review request with the proper change description, etc.).
TODO:
- Test/handle more complex cases (merge commits, branch creation, etc.). - - Add a fix so the hook can close private review requests. - Refactor. - Testing Done:
-
Added the post-receive webhook URL to a private GitHub repository, and tested different pushes:
- Commit with a review request ID that is not submitted (verified that the review request is closed and set to submitted) - Commit with a review request ID that is already submitted (got a warning that the review request is already submitted) ~ - Commit without a review request ID in the commit message (got a debug message that no matching review request ID was found) ~ - Commit without a review request ID in the commit message (got a debug message that no matching review request ID was found) + - Commit with a private review request (verified that the review request is closed) - Depends On:
-
- Commit:
9bab2d4730596769fcf6c7e418243e348ba84a6cb7c3a5a42367ef462cdda57a8d9251e89c57503c
Add GitHub post-receive hook to close review requests automatically.
Review Request #5596 — Created March 7, 2014 and submitted
This is a GitHub post-receive hook that will automatically close review requests as "submitted" after a push. To determine which review requests should be closed, it scans through each commit's commit message for the following strings (case-insensitive): "Reviewed at <reviewboard_url>/r/<id>" or "Review request #<id>". The regex used for this can be overriden in settings_local.py.
Added the post-receive webhook URL to a private GitHub repository, and tested different pushes:
- Commit with a review request ID that is not submitted (verified that the review request is closed and set to submitted)
- Commit with a review request ID that is already submitted (got a warning that the review request is already submitted)
- Commit without a review request ID in the commit message (got a debug message that no matching review request ID was found)
- Commit with a private review request (verified that the review request is closed)
- Commits referencing the same review request ID
- Multiple commits
- Merge commits
- Branch creation and deletion
- Commits pushed to two branchesI also overrode the regex and flags in settings_local.py, and got the expected change in matching review request IDs.
Description | From | Last Updated |
---|---|---|
Should probably be a @classmethod of HostingService in service.py which can be overriden by individual services like Github and Bitbucket. … |
B. b.ramnani | |
Same can be said about this method. This should probably be a private method. i.e. renamed to _get_review_id_to_commits_map... |
B. b.ramnani | |
Blank line at the end |
B. b.ramnani | |
A blank line below this last line. |
B. b.ramnani | |
We generally list full-package imports ahead of single-item imports, so the from one should go after import logging. |
david | |
How about we turn these into ints? |
david | |
There's an extra blank line here. |
david | |
There's an extra blank line here. |
david | |
Can you wrap this in parentheses instead of using the character? |
david | |
This function returns "http://example.com" on my localhost, when I tested for post-receive hook for the bitbucket repo. Is that the … |
B. b.ramnani |
- Description:
-
~ This is the initial implementation of the GitHub post-receive hook that will automatically close review requests as "submitted" after a push. To determine which review requests should be closed, it scans through each commit's commit message for the following strings (case-insensitive): "Reviewed at <reviewboard_url>/r/<id>" or "Review request #<id>".
~ This is a GitHub post-receive hook that will automatically close review requests as "submitted" after a push. To determine which review requests should be closed, it scans through each commit's commit message for the following strings (case-insensitive): "Reviewed at <reviewboard_url>/r/<id>" or "Review request #<id>".
- - It currently works for simple use cases (pushing a commit that references /r/<id> automatically closes that review request with the proper change description, etc.).
TODO:
- - Test/handle more complex cases (merge commits, branch creation, etc.). - Refactor. - Testing Done:
-
Added the post-receive webhook URL to a private GitHub repository, and tested different pushes:
- Commit with a review request ID that is not submitted (verified that the review request is closed and set to submitted) - Commit with a review request ID that is already submitted (got a warning that the review request is already submitted) - Commit without a review request ID in the commit message (got a debug message that no matching review request ID was found) ~ - Commit with a private review request (verified that the review request is closed) ~ - Commit with a private review request (verified that the review request is closed) + - Commits referencing the same review request ID + - Multiple commits + - Merge commits + - Branch creation and deletion + - Commits pushed to two branches - Commit:
-
b7c3a5a42367ef462cdda57a8d9251e89c57503c0d3bb7bd5afcd2f96cb72b0c6b3589eb09540131
- Added Files:
- Description:
-
This is a GitHub post-receive hook that will automatically close review requests as "submitted" after a push. To determine which review requests should be closed, it scans through each commit's commit message for the following strings (case-insensitive): "Reviewed at <reviewboard_url>/r/<id>" or "Review request #<id>".
TODO:
~ - Refactor. ~ - Make the regex customizable. - Commit:
-
0d3bb7bd5afcd2f96cb72b0c6b3589eb0954013182f1c89dcf6b2129647c45e28c7e3bb691f51457
- Change Summary:
-
Made the regex customizable.
- Summary:
-
[WIP] Add GitHub post-receive hook to close review requests automatically.Add GitHub post-receive hook to close review requests automatically.
- Description:
-
~ This is a GitHub post-receive hook that will automatically close review requests as "submitted" after a push. To determine which review requests should be closed, it scans through each commit's commit message for the following strings (case-insensitive): "Reviewed at <reviewboard_url>/r/<id>" or "Review request #<id>".
~ This is a GitHub post-receive hook that will automatically close review requests as "submitted" after a push. To determine which review requests should be closed, it scans through each commit's commit message for the following strings (case-insensitive): "Reviewed at <reviewboard_url>/r/<id>" or "Review request #<id>". The regex used for this can be overriden in settings_local.py.
- - TODO:
- - Make the regex customizable. - Testing Done:
-
Added the post-receive webhook URL to a private GitHub repository, and tested different pushes:
- Commit with a review request ID that is not submitted (verified that the review request is closed and set to submitted) - Commit with a review request ID that is already submitted (got a warning that the review request is already submitted) - Commit without a review request ID in the commit message (got a debug message that no matching review request ID was found) - Commit with a private review request (verified that the review request is closed) - Commits referencing the same review request ID - Multiple commits - Merge commits - Branch creation and deletion - Commits pushed to two branches + + I also overrode the regex and flags in settings_local.py, and got the expected change in matching review request IDs.
- Commit:
-
82f1c89dcf6b2129647c45e28c7e3bb691f51457e962798b51c6c7d49d9785a77d951818fd0d6025
-
-
Should probably be a @classmethod of HostingService in service.py which can be overriden by individual services like Github and Bitbucket. Would increase reusability. Would also increase encapsulation, since the repository_url_patterns need to reference this view. Maybe the mentors could comment on that.
-
Same can be said about this method. This should probably be a private method. i.e. renamed to _get_review_id_to_commits_map...
- Change Summary:
-
Defined the hook URL in github.py instead (depends on /r/5510).
- Depends On:
-
- Commit:
3fef25d52185f7b50842fa94fa3d6d856c754cfaf618eafe99d97e81914aa313e671771558b3f0ad
- Change Summary:
-
Changed all review request ID variables to ints, and fixed style issues.
- Commit:
-
f618eafe99d97e81914aa313e671771558b3f0ad2ea55e6987331e35edb068e2a104fcf464479104
- Change Summary:
-
Added a try/except block to make sure the payload is in JSON format before processing it (since GitHub also supports x-www-form-urlencoded).
- Commit:
-
c673359f58c09014987475e8a977a971631cad1c798641bb69e2e86adc690cc634df186f3e53331f