Bitbucket post-receive hook
Review Request #5653 — Created March 22, 2014 and submitted
This is a Bitbucket 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.
Basic testing on a git repo performed. Test passed successfully (see screenshot).
All tests carried out on both mercurial and git repos.
Tests:
1) Close an open review request. [PASSED]
2) Try to close a review request that already has been closed as submitted. (Logged a warning saying that the review request has already been submitted). [PASSED]
3) Try to close a discarded review request. (Marked the review request as submitted) [PASSED]
4) Push without a review request id in commit message. (Error logged that the request id does not exist). [PASSED]
5) Push with a non existent request id in the commit message. (Error logged as Review request id does not exist.) [PASSED]
Description | From | Last Updated |
---|---|---|
This can be combined to a single import (http://docs.python.org/2/reference/simple_stmts.html#the-import-statement) |
TO tomiaijo | |
Change this to: repository_url_patterns = patterns( '', url(r'^hooks/post-receive/$', 'reviewboard.hostingsvcs.tests.hosting_service_url_test_view') ) |
anselina | |
Trailing whitespace |
TO tomiaijo | |
You should delete these lines because the URLs are already dynamically generated. |
anselina | |
Mixed tabs and whitespaces |
TO tomiaijo | |
Only for temporary testing |
B. b.ramnani | |
You didn't add any logging, so this import can go away. |
david | |
This isn't used. |
david | |
This line isn't necessary. |
david | |
If review_id_to_commits is an empty map, close_all_review_requests will be a no-op. Therefore I think you can remove the test and … |
david |
-
Making these changes should fix the problem you mentioned in your status report about the URLs not being added for Bitbucket! (Using your code in /r/5510, I've checked that the URLs are properly generated for GitHub, so everything's fine there.)
-
Change this to:
repository_url_patterns = patterns( '', url(r'^hooks/post-receive/$', 'reviewboard.hostingsvcs.tests.hosting_service_url_test_view') )
-
- Change Summary:
-
Bitbucket post-receive hook: Draft 1
- Testing Done:
-
+ Basic testing on a git repo performed. Test passed successfully (see screenshot). Trying to test for mercurial repo but unable to do rbt post. see error below:
+ + http://pastie.org/8977819
+ + Would appreciate some help for above.
+ + + + Further testing on both git and mercurial repos is pending.
- People:
-
- Diff:
Revision 2 (+10 -12)
- Added Files:
- Description:
-
~ Project to close review requests automatically when pushed to the bitbucket repository.
~ This is a Bitbucket 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.
+ + + + To Do:
+ 1) add check to see if the commit id in the review request matches the revision that got pushed (as suggested by David) + 2) Further testing on both git and mercurial repos is pending. - Testing Done:
-
Basic testing on a git repo performed. Test passed successfully (see screenshot). Trying to test for mercurial repo but unable to do rbt post. see error below:
http://pastie.org/8977819
Would appreciate some help for above.
- - - - Further testing on both git and mercurial repos is pending.
- Change Summary:
-
Added more tests
- Description:
-
This is a Bitbucket 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.
- - - - To Do:
- 1) add check to see if the commit id in the review request matches the revision that got pushed (as suggested by David) - 2) Further testing on both git and mercurial repos is pending. - Testing Done:
-
~ Basic testing on a git repo performed. Test passed successfully (see screenshot). Trying to test for mercurial repo but unable to do rbt post. see error below:
~ Basic testing on a git repo performed. Test passed successfully (see screenshot).
~ http://pastie.org/8977819
~ ~ Would appreciate some help for above.
~ Tests:
~ 1) Close an open review request. [PASSED] ~ 2) Try to close a review request that already has been closed as submitted. (Logged a warning saying that the review request has already been submitted). [PASSED] + 3) Try to close a discarded review request. (Marked the review request as submitted) [PASSED] + 4) Push without a review request id in commit message. (Error logged that the request id does not exist). [PASSED] + 5) Push with a non existent request id in the commit message. (Error logged as Review request id does not exist.) [PASSED] + 6) While trying to test feature implemented in rr #5666, I found that it wasn't working because the commit id for the review request was not updated on reviewboard backend. [FAILED] + 7) Push a change with someone else's review request id in the commit message. Was able to close someone else's review request. [FAILED]
- Change Summary:
-
Added tests for mercurial repo.
- Testing Done:
-
Basic testing on a git repo performed. Test passed successfully (see screenshot).
+ All tests carried out on both mercurial and git repos.
+ Tests:
1) Close an open review request. [PASSED] 2) Try to close a review request that already has been closed as submitted. (Logged a warning saying that the review request has already been submitted). [PASSED] 3) Try to close a discarded review request. (Marked the review request as submitted) [PASSED] 4) Push without a review request id in commit message. (Error logged that the request id does not exist). [PASSED] 5) Push with a non existent request id in the commit message. (Error logged as Review request id does not exist.) [PASSED] 6) While trying to test feature implemented in rr #5666, I found that it wasn't working because the commit id for the review request was not updated on reviewboard backend. [FAILED] 7) Push a change with someone else's review request id in the commit message. Was able to close someone else's review request. [FAILED]
- Testing Done:
-
Basic testing on a git repo performed. Test passed successfully (see screenshot).
All tests carried out on both mercurial and git repos.
Tests:
1) Close an open review request. [PASSED] 2) Try to close a review request that already has been closed as submitted. (Logged a warning saying that the review request has already been submitted). [PASSED] 3) Try to close a discarded review request. (Marked the review request as submitted) [PASSED] 4) Push without a review request id in commit message. (Error logged that the request id does not exist). [PASSED] 5) Push with a non existent request id in the commit message. (Error logged as Review request id does not exist.) [PASSED] ~ 6) While trying to test feature implemented in rr #5666, I found that it wasn't working because the commit id for the review request was not updated on reviewboard backend. [FAILED] ~ 6) While trying to test feature implemented in rr #5666, I found that it wasn't working because the commit id for the review request was not updated on reviewboard backend. [FAILED] - 7) Push a change with someone else's review request id in the commit message. Was able to close someone else's review request. [FAILED]
- Testing Done:
-
Basic testing on a git repo performed. Test passed successfully (see screenshot).
All tests carried out on both mercurial and git repos.
Tests:
1) Close an open review request. [PASSED] 2) Try to close a review request that already has been closed as submitted. (Logged a warning saying that the review request has already been submitted). [PASSED] 3) Try to close a discarded review request. (Marked the review request as submitted) [PASSED] 4) Push without a review request id in commit message. (Error logged that the request id does not exist). [PASSED] ~ 5) Push with a non existent request id in the commit message. (Error logged as Review request id does not exist.) [PASSED] ~ 5) Push with a non existent request id in the commit message. (Error logged as Review request id does not exist.) [PASSED] - 6) While trying to test feature implemented in rr #5666, I found that it wasn't working because the commit id for the review request was not updated on reviewboard backend. [FAILED]