-
-
reviewboard/hostingsvcs/bitbucket.py (Diff revision 1) This can be combined to a single import (http://docs.python.org/2/reference/simple_stmts.html#the-import-statement)
-
-
Bitbucket post-receive hook
Review Request #5653 — Created March 22, 2014 and submitted
Information | |
---|---|
b.ramnani | |
Review Board | |
master | |
|
|
891b835... | |
Reviewers | |
reviewboard | |
anselina, chipx86, david, mike_conley, smacleod |
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') ) |
|
|
Trailing whitespace |
TO tomiaijo | |
You should delete these lines because the URLs are already dynamically generated. |
|
|
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. |
|
|
This isn't used. |
|
|
This line isn't necessary. |
|
|
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 … |
|
-
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.)
-
reviewboard/hostingsvcs/bitbucket.py (Diff revision 1) Change this to:
repository_url_patterns = patterns( '', url(r'^hooks/post-receive/$', 'reviewboard.hostingsvcs.tests.hosting_service_url_test_view') )
-
reviewboard/hostingsvcs/urls.py (Diff revision 1) You should delete these lines because the URLs are already dynamically generated.
Change Summary:
Bitbucket post-receive hook: Draft 1
Testing Done: |
|
|||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
People: |
|
|||||||||||||||||||||||||||
Diff: |
Revision 2 (+10 -12) |
|||||||||||||||||||||||||||
Added Files: |
Description: |
|
|||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Testing Done: |
|
Change Summary:
Added more tests
Description: |
|
||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Testing Done: |
|
Change Summary:
Added tests for mercurial repo.
Testing Done: |
|
---|
Testing Done: |
|
---|
Testing Done: |
|
---|
-
-
reviewboard/hostingsvcs/bitbucket.py (Diff revision 4) You didn't add any logging, so this import can go away.
-
-
-
reviewboard/hostingsvcs/bitbucket.py (Diff revision 4) 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 early return.
Change Summary:
Removed the unused imports and the check for review_id_to_commits_map to be None.
Commit: |
|
||||
---|---|---|---|---|---|
Diff: |
Revision 5 (+50) |