Auto-populating branch for new post-commit review requests
Review Request #7659 — Created Sept. 25, 2015 and submitted
When creating a new post-commit review request, the branch name was left blank rather than being pre-populated. Since we have the data available, this should be populated.
Added branch info to the request url when creating the new ReviewRequest, webAPI takes care of the rest.Corrected API breaking issue. When no branch was provided in API request, None would be attempt to be saved to the database but branch had a Not Null constraint.
Added additional tests to cover this case.
Ran all reviewboard tests.
Added new API tests for post with and without branch info.
Description | From | Last Updated |
---|---|---|
I would prefer if we just provided the branch: this.model.collection.options.branch key-value-pair in the createFromCommit call. Its cleaner. Also, the only … |
brennie | |
Context is the this object that the callbacks will be bound to. You don't really want to be modifying it. |
brennie | |
'pdb' imported but unused |
reviewbot | |
'pdb' imported but unused |
reviewbot | |
Col: 9 E265 block comment should start with '# ' |
reviewbot | |
redefinition of unused 'pdb' from line 4 |
reviewbot | |
Col: 23 E231 missing whitespace after ';' |
reviewbot | |
Col: 23 E702 multiple statements on one line (semicolon) |
reviewbot | |
Col: 39 E703 statement ends with a semicolon |
reviewbot | |
Col: 13 E122 continuation line missing indentation or outdented |
reviewbot | |
Col: 13 E122 continuation line missing indentation or outdented |
reviewbot | |
Col: 80 E501 line too long (81 > 79 characters) |
reviewbot | |
Col: 28 E131 continuation line unaligned for hanging indent |
reviewbot | |
Do you mean as a keyword parameter for the create function? Because that's already the case. Is this suggestion so … |
AH ahache | |
You can add branch=None as a keyword argument to create. |
brennie | |
Col: 34 E225 missing whitespace around operator |
reviewbot | |
Col: 41 E703 statement ends with a semicolon |
reviewbot | |
You should be able to just include branch=branch, in the self.model() call above. |
david | |
To keep this consistent with the repository, please use branch = this.model.get('branch') and then pass in branch.id below. Although, perhaps … |
david | |
Remove this commented out code. |
brennie | |
No blank line here. |
brennie | |
Can you format this as: review_request = ReviewRequest.objects.get( pkg=rsp['review_request']['id']) |
brennie | |
Can you put this on the previous line? |
brennie | |
Can you format this as: review_request = ReviewRequest.objects.get( pkg=rsp['review_request']['id']) |
brennie |
-
-
I would prefer if we just provided the
branch: this.model.collection.options.branch
key-value-pair in thecreateFromCommit
call. Its cleaner.Also, the only time the branch will be set is when creating it via the post-commit UI. In that case, it makes sense to
set()
the data inreviewRequestModel.js:createFromCommit
. -
Context is the
this
object that the callbacks will be bound to. You don't really want to be modifying it.
- Summary:
-
WIP: Trying to auto-populate branch name when creating a post-commit review requestAuto-populating branch for new post-commit review requests
- Description:
-
~ WIP: Trying to auto-populate branch name when creating a post-commit review request
~ Auto-populating branch for new post-commit review requests by adding branch field to the repositoryCommitsCollection. Passing the data along when creating a new ReviewRequest from an existing commit by modifiy the toJSON method in reviewRequestModel.js, and webAPI takes care of the rest.
- Diff:
-
Revision 2 (+28 -5)
-
Tool: Pyflakes Processed Files: reviewboard/webapi/resources/review_request.py reviewboard/reviews/managers.py Ignored Files: reviewboard/static/rb/js/resources/models/repositoryCommitModel.js reviewboard/static/rb/js/newReviewRequest/views/postCommitView.js reviewboard/static/rb/js/resources/models/baseResourceModel.js reviewboard/static/rb/js/resources/collections/repositoryCommitsCollection.js reviewboard/static/rb/js/resources/models/reviewRequestModel.js reviewboard/static/rb/js/newReviewRequest/views/commitView.js Tool: PEP8 Style Checker Processed Files: reviewboard/webapi/resources/review_request.py reviewboard/reviews/managers.py Ignored Files: reviewboard/static/rb/js/resources/models/repositoryCommitModel.js reviewboard/static/rb/js/newReviewRequest/views/postCommitView.js reviewboard/static/rb/js/resources/models/baseResourceModel.js reviewboard/static/rb/js/resources/collections/repositoryCommitsCollection.js reviewboard/static/rb/js/resources/models/reviewRequestModel.js reviewboard/static/rb/js/newReviewRequest/views/commitView.js
-
-
- Diff:
-
Revision 3 (+29 -5)
-
Tool: Pyflakes Processed Files: reviewboard/webapi/resources/review_request.py reviewboard/reviews/managers.py Ignored Files: reviewboard/static/rb/js/resources/models/repositoryCommitModel.js reviewboard/static/rb/js/newReviewRequest/views/postCommitView.js reviewboard/static/rb/js/resources/models/baseResourceModel.js reviewboard/static/rb/js/resources/collections/repositoryCommitsCollection.js reviewboard/static/rb/js/resources/models/reviewRequestModel.js reviewboard/static/rb/js/newReviewRequest/views/commitView.js Tool: PEP8 Style Checker Processed Files: reviewboard/webapi/resources/review_request.py reviewboard/reviews/managers.py Ignored Files: reviewboard/static/rb/js/resources/models/repositoryCommitModel.js reviewboard/static/rb/js/newReviewRequest/views/postCommitView.js reviewboard/static/rb/js/resources/models/baseResourceModel.js reviewboard/static/rb/js/resources/collections/repositoryCommitsCollection.js reviewboard/static/rb/js/resources/models/reviewRequestModel.js reviewboard/static/rb/js/newReviewRequest/views/commitView.js
-
-
- Diff:
-
Revision 4 (+29 -5)
-
Tool: Pyflakes Processed Files: reviewboard/webapi/resources/review_request.py reviewboard/reviews/managers.py Ignored Files: reviewboard/static/rb/js/resources/models/repositoryCommitModel.js reviewboard/static/rb/js/newReviewRequest/views/postCommitView.js reviewboard/static/rb/js/resources/models/baseResourceModel.js reviewboard/static/rb/js/resources/collections/repositoryCommitsCollection.js reviewboard/static/rb/js/resources/models/reviewRequestModel.js reviewboard/static/rb/js/newReviewRequest/views/commitView.js Tool: PEP8 Style Checker Processed Files: reviewboard/webapi/resources/review_request.py reviewboard/reviews/managers.py Ignored Files: reviewboard/static/rb/js/resources/models/repositoryCommitModel.js reviewboard/static/rb/js/newReviewRequest/views/postCommitView.js reviewboard/static/rb/js/resources/models/baseResourceModel.js reviewboard/static/rb/js/resources/collections/repositoryCommitsCollection.js reviewboard/static/rb/js/resources/models/reviewRequestModel.js reviewboard/static/rb/js/newReviewRequest/views/commitView.js
-
Tool: PEP8 Style Checker Processed Files: reviewboard/webapi/resources/review_request.py reviewboard/reviews/managers.py Ignored Files: reviewboard/static/rb/js/newReviewRequest/views/commitView.js reviewboard/static/rb/js/newReviewRequest/views/postCommitView.js reviewboard/static/rb/js/resources/models/reviewRequestModel.js Tool: Pyflakes Processed Files: reviewboard/webapi/resources/review_request.py reviewboard/reviews/managers.py Ignored Files: reviewboard/static/rb/js/newReviewRequest/views/commitView.js reviewboard/static/rb/js/newReviewRequest/views/postCommitView.js reviewboard/static/rb/js/resources/models/reviewRequestModel.js
-
Tool: Pyflakes Processed Files: reviewboard/webapi/resources/review_request.py reviewboard/reviews/managers.py Ignored Files: reviewboard/static/rb/js/newReviewRequest/views/postCommitView.js reviewboard/static/rb/js/resources/models/reviewRequestModel.js Tool: PEP8 Style Checker Processed Files: reviewboard/webapi/resources/review_request.py reviewboard/reviews/managers.py Ignored Files: reviewboard/static/rb/js/newReviewRequest/views/postCommitView.js reviewboard/static/rb/js/resources/models/reviewRequestModel.js
- Bugs:
- Description:
-
~ Auto-populating branch for new post-commit review requests by adding branch field to the repositoryCommitsCollection. Passing the data along when creating a new ReviewRequest from an existing commit by modifiy the toJSON method in reviewRequestModel.js, and webAPI takes care of the rest.
~ Auto-populating branch for new post-commit review requests. Added branch info to _onCreateReviewRequest in postCommitView.js before redirecting to the new RR, modified the toJSON method in reviewRequestModel.js, and added a branch parameter to the RR create method in managers.py. webAPI takes care of the rest.
-
-
Do you mean as a keyword parameter for the create function? Because that's already the case. Is this suggestion so that kwargs.get('branch', None) becomes kwargs.get('branch') ? If so, I had it that way at first but then changed it to have the default None value incase an API call was made to create the post-commit RR without passing branch information.
-
Tool: Pyflakes Processed Files: reviewboard/webapi/resources/review_request.py reviewboard/reviews/managers.py Ignored Files: reviewboard/static/rb/js/newReviewRequest/views/postCommitView.js reviewboard/static/rb/js/resources/models/reviewRequestModel.js Tool: PEP8 Style Checker Processed Files: reviewboard/webapi/resources/review_request.py reviewboard/reviews/managers.py Ignored Files: reviewboard/static/rb/js/newReviewRequest/views/postCommitView.js reviewboard/static/rb/js/resources/models/reviewRequestModel.js
-
The description field doesn't need to describe exactly what changed in the code -- thats what the diff is for :)
Instead, it should outline the problem that this patch fixes and how it is solved (in a very high-level way).
Otherwise this patch looks great! Clean that up and we'll get it landed :)
- Description:
-
~ Auto-populating branch for new post-commit review requests. Added branch info to _onCreateReviewRequest in postCommitView.js before redirecting to the new RR, modified the toJSON method in reviewRequestModel.js, and added a branch parameter to the RR create method in managers.py. webAPI takes care of the rest.
~ Auto-populating branch for new post-commit review requests. Added branch info to the request url when creating the new RR, webAPI takes care of the rest.
- Testing Done:
-
~ Testing still to come, going to dig around to find how to write appropriate tests cases for this. Any suggestions are welcome.
~ Ran all reviewboard tests.
- Description:
-
~ Auto-populating branch for new post-commit review requests. Added branch info to the request url when creating the new RR, webAPI takes care of the rest.
~ When creating a new post-commit review request, the branch name was left blank rather than being pre-populated. Since we have the data available, this should be populated.
+ Added branch info to the request url when creating the new ReviewRequest, webAPI takes care of the rest.
-
Tool: Pyflakes Processed Files: reviewboard/webapi/resources/review_request.py reviewboard/reviews/managers.py Ignored Files: reviewboard/static/rb/js/newReviewRequest/views/postCommitView.js reviewboard/static/rb/js/resources/models/reviewRequestModel.js Tool: PEP8 Style Checker Processed Files: reviewboard/webapi/resources/review_request.py reviewboard/reviews/managers.py Ignored Files: reviewboard/static/rb/js/newReviewRequest/views/postCommitView.js reviewboard/static/rb/js/resources/models/reviewRequestModel.js
-
-
-
Tool: Pyflakes Processed Files: reviewboard/webapi/resources/review_request.py reviewboard/reviews/managers.py Ignored Files: reviewboard/static/rb/js/newReviewRequest/views/postCommitView.js reviewboard/static/rb/js/resources/models/reviewRequestModel.js Tool: PEP8 Style Checker Processed Files: reviewboard/webapi/resources/review_request.py reviewboard/reviews/managers.py Ignored Files: reviewboard/static/rb/js/newReviewRequest/views/postCommitView.js reviewboard/static/rb/js/resources/models/reviewRequestModel.js
-
Tool: Pyflakes Processed Files: reviewboard/webapi/resources/review_request.py reviewboard/reviews/managers.py Ignored Files: reviewboard/static/rb/js/newReviewRequest/views/postCommitView.js reviewboard/static/rb/js/resources/models/reviewRequestModel.js Tool: PEP8 Style Checker Processed Files: reviewboard/webapi/resources/review_request.py reviewboard/reviews/managers.py Ignored Files: reviewboard/static/rb/js/newReviewRequest/views/postCommitView.js reviewboard/static/rb/js/resources/models/reviewRequestModel.js
-
This looks good now, but I'm going to hold off on pushing it because we're on the cusp of releasing 2.5. I'll get it in for 2.5.1
-
Unfortunately, this ended up breaking our API, so we're having to revert it and re-release.
Can you update this to inclue a set of unit tests that test this addition?
The specific breakage is documented on https://hellosplat.com/s/beanbag/tickets/4009/
-
Tool: Pyflakes Processed Files: reviewboard/webapi/tests/test_review_request.py reviewboard/webapi/resources/review_request.py reviewboard/reviews/managers.py Ignored Files: reviewboard/static/rb/js/newReviewRequest/views/postCommitView.js reviewboard/static/rb/js/resources/models/reviewRequestModel.js Tool: PEP8 Style Checker Processed Files: reviewboard/webapi/tests/test_review_request.py reviewboard/webapi/resources/review_request.py reviewboard/reviews/managers.py Ignored Files: reviewboard/static/rb/js/newReviewRequest/views/postCommitView.js reviewboard/static/rb/js/resources/models/reviewRequestModel.js
- Description:
-
When creating a new post-commit review request, the branch name was left blank rather than being pre-populated. Since we have the data available, this should be populated.
Added branch info to the request url when creating the new ReviewRequest, webAPI takes care of the rest. + + Corrected API breaking issue. When no branch was provided in API request, None would be attempt to be saved to the database but branch had a Not Null constraint.
+ Added additional tests to cover this case. - Testing Done:
-
~ Ran all reviewboard tests.
~ Ran all reviewboard tests.
+ Added new API tests for post with and without branch info.
-
Tool: Pyflakes Processed Files: reviewboard/webapi/tests/test_review_request.py reviewboard/webapi/resources/review_request.py reviewboard/reviews/managers.py Ignored Files: reviewboard/static/rb/js/newReviewRequest/views/postCommitView.js reviewboard/static/rb/js/resources/models/reviewRequestModel.js Tool: PEP8 Style Checker Processed Files: reviewboard/webapi/tests/test_review_request.py reviewboard/webapi/resources/review_request.py reviewboard/reviews/managers.py Ignored Files: reviewboard/static/rb/js/newReviewRequest/views/postCommitView.js reviewboard/static/rb/js/resources/models/reviewRequestModel.js