- Change Summary:
-
Updated matching logic to use Summary and Description.
Added comments and made minor changes. - Description:
-
[WIP] Add option to 'post' to determine existing review request to update
Work In Progress:
rbt -u will attempt to determine the existing review request to update
as a convenient alternative than specifying the request id using -r. Currently rbt -u matches the first review request it finds which is
submitted by the logged in user, if the exsiting request summary ~ is the same as the summary specified in the new change. ~ and description are 'close enough' to the summary and description + specified in the new change. + + Reviewed at https://reviews.reviewboard.org/r/4699
- Diff:
-
Revision 2 (+85 -2)
Enhance rbt post to automatically determine the existing review request
Review Request #4699 — Created Oct. 8, 2013 and submitted
Enhance rbt post to automatically determine the existing review request
rbt -u
automatically determines the existing review request to update. It
suggests a pending review request by the current user in the current
repository, based on the request summary and description.If the summary and description exactly match those of an existing request,
the request is immediately updated. Otherwise, the user is prompted to confirm
a suggestion from a ranked list of potential matches.Reviewed at https://reviews.reviewboard.org/r/4699
-Tested with Git, Mercurial, and Bazaar using, with and without 'revision range'.
-Unit tests pass.
Description | From | Last Updated |
---|---|---|
difflib belongs in the group above, as it's shipped with Python. |
chipx86 | |
That's kind of a long full name. How about just --update? |
chipx86 | |
Any modifications to existing command options, or behavior need to be updated in the documentation as well (This includes adding … |
SM smacleod | |
This seems like it could be useful outside of post, such as in your command for generating configuration. I could … |
SM smacleod | |
This is wrapped very strangely. Should be more like: has_... = ( self.options.guess_fields or (self.options.summary and self.options.description) ) Other valid … |
chipx86 | |
Blank line before. |
chipx86 | |
I'm not sure if this is true. Let's assume we don't have --guess-fields set, and we aren't provided a summary … |
SM smacleod | |
Summary should be on the """ line. |
chipx86 | |
You can avoid keeping track of the index by doing: for seq_a, seq_b in zip(sequences_a, sequences_b): |
chipx86 | |
Blank line before. |
chipx86 | |
Blank line before an if. These two can be one statement, though. |
chipx86 | |
Blank line before. |
chipx86 | |
I think this might be better suited outside of "post_request()". It would be nice if we could minimize the complexity … |
SM smacleod | |
This should also filter by repository. It's not valid to update a review request on a different repository. |
chipx86 | |
Blank line before. |
chipx86 | |
Should be: print ('....' % user.username) |
chipx86 | |
Just return. No exit. Same below. |
chipx86 | |
Blank line before. |
chipx86 | |
Like I mentioned in r/4662 , API resources are paged, so just looping through the first page will not retrieve … |
SM smacleod | |
Blank line before. |
chipx86 | |
Wrapping is best done as: question = ('...' % (request.id, request.summary)) Also, space after ":" |
chipx86 | |
I don't like always having to be asked. The majority of the time, things will be identical, and I can … |
chipx86 | |
Blank line before. |
chipx86 | |
Sounds more human if you say ".. the existing review request" |
chipx86 | |
Needs two colons at the end, to trigger the code block for the next line. (It's a ReST construct.) |
chipx86 | |
"Determine the existing review request to update." |
chipx86 | |
"Guess" doesn't really say what it's doing with this. I'd specifically say "Return the summary ..." |
chipx86 | |
Same here. |
chipx86 | |
"Return the revision ..." |
chipx86 | |
You can just return in the above, instead of at the end. |
chipx86 | |
Blank line between these. |
chipx86 | |
What happened with this logic? |
chipx86 | |
There's a lot of code repeated here. I'd suggest having the conditionals compute the revision only, and then do the … |
chipx86 | |
Same here. |
chipx86 | |
"Returns the ..." |
chipx86 | |
"Returns the ..." Make sure the rest of the change is in that format. "Gets" doesn't mean it's returning anything … |
chipx86 | |
Blank line before this. |
chipx86 | |
Should follow the standard format of: """One-line summary. Multi-line description. """ |
chipx86 | |
Since r1 and r2 aren't used, you can just do: revision = self._extract_revisions(...)[1] |
chipx86 | |
Same here. |
chipx86 | |
Might as well store as rev1, and not rename a variable. |
chipx86 | |
Parent branch of what? The docs should be explicit, so there's no uncertainty about what it's based off of. |
chipx86 | |
"Returns" Can you explain more what this function does? From the description, it's not immediately obvious what this data is … |
chipx86 | |
You don't need the `` in the summaries. It's best not to specify the variable names in summaries, actually. Say … |
chipx86 | |
Blank line before this. |
chipx86 | |
Terminology is "review requests", specifically. "requests" usually means something else, like an HTTP request. Can you also update the variable … |
chipx86 | |
Comments should be in sentence casing, ending with a period. |
chipx86 | |
Can you use "ID" instead of "id" in the docstring? |
chipx86 | |
Blank line before this. |
chipx86 | |
You can just do: if not requests: |
chipx86 | |
This sounds like an error. We should fail without a successful return code. |
chipx86 | |
No need for the parens. |
chipx86 | |
The comments shouldn't go between the conditionals. Try rewriting to describe what's happening when it hits that conditional, and put … |
chipx86 | |
Same comment about review_request vs. request. |
chipx86 | |
This is also an error, so we need to fail with an error. |
chipx86 | |
Can be one statement. |
chipx86 | |
Should be one line. |
chipx86 | |
Should be review_request, rather than request. |
chipx86 | |
review_requests |
chipx86 | |
Shouldn't be any blank lines before an except: line. |
chipx86 | |
I know this was old code, but can you change it to "please reopen the review request" ? |
chipx86 | |
"No review_request_id" |
chipx86 | |
It's a pretty unlikely situation, but we might want to verify that there's only one exact match before automatically choosing … |
david |
-
-
-
-
This is wrapped very strangely. Should be more like:
has_... = (
self.options.guess_fields or
(self.options.summary and self.options.description)
)Other valid options, though, are --guess-summary + --guess-description, so that should be handled too. Those predate --guess-fields, so people may have those set in scripts.
In fact, setting --guess-fields just sets self.options.guess_summary and guess_description, so just check for those.
-
-
-
I'm not sure how I feel about using diff logic for this. It's very easy to get false-positives/negatives. I'd like to know what other people think.
-
You can avoid keeping track of the index by doing:
for seq_a, seq_b in zip(sequences_a, sequences_b):
-
-
-
-
This should also filter by repository. It's not valid to update a review request on a different repository.
-
-
-
-
-
-
-
I don't like always having to be asked. The majority of the time, things will be identical, and I can feel safe about that. Instead, I'd want to know if they're an exact match, or a fuzzy match.
Thinking about this more, I think I'd prefer the following logic:
- If the sets of fields are identical, assume it's the correct one.
- If the summary is identical, but the description is different, prompt.
That way, we can be pretty sure in the common case that nothing has changed, and in the case of the description being augmented, we can confirm. The user has a clear expectation of what will happen in each case, and doesn't have to worry about how different the summary/description is.
That also avoids things like a summary of "Fixes bug 123 in my module" from appearing to be a valid option when compared against "Fixes bug 124 in my module".
-
-
-
-
Any modifications to existing command options, or behavior need to be updated in the documentation as well (This includes adding commands such as in your other review requests).
see "rbtools/docs/rbtools/rbt/commands/post.txt"
-
This seems like it could be useful outside of post, such as in your command for generating configuration. I could imagine uses in other commands, or new commands as well.
How about we move this out to utils or something?
-
I'm not sure if this is true. Let's assume we don't have --guess-fields set, and we aren't provided a summary or description:
We could still detect they'd like to update, and run the code to guess the fields to generate them, but we just won't update the fields when we update the request.
-
I think this might be better suited outside of "post_request()".
It would be nice if we could minimize the complexity of the method, and instead just have the guessing code live somewhere else that possibly runs first.
How about we refactor post_request() to take the review request ID as an argument, defaulted to None. If it is None, we create the new review request, and if it's provided we update that one?
-
Like I mentioned in r/4662 , API resources are paged, so just looping through the first page will not retrieve every resource. See my comment in the other review request.
- Change Summary:
-
Replaced is_close_match() with get_match_score() to support ranking.
Fixed various styling issues. - Diff:
-
Revision 3 (+108 -2)
- Change Summary:
-
-Update detection logic
-Fix a few issues from previous patches - Description:
-
[WIP] Add option to 'post' to determine existing review request to update
Work In Progress:
~ rbt -u will attempt to determine the existing review request to update
~ as a convenient alternative than specifying the request id using -r. ~ rbt -u
will attempt to determine the existing review request to update~ as a convenient alternative than specifying the request id using -r
.~ Currently rbt -u matches the first review request it finds which is
~ submitted by the logged in user, if the exsiting request summary ~ rbt -u
suggests existing review request submitted by the logged in user~ for the current repository based on the request summary and description. - and description are 'close enough' to the summary and description - specified in the new change. Reviewed at https://reviews.reviewboard.org/r/4699
- Testing Done:
-
- This review request was updated with 'rbt -g -u'.
- Diff:
-
Revision 4 (+162 -12)
- Change Summary:
-
-Refactor summary and description guessing to their own methods
-Always guess summary and description whenever --update is used
-Update documentation - Description:
-
~ [WIP] Add option to 'post' to determine existing review request to update
~ Enhance rbt post to automatically determine the existing review request
~ Work In Progress:
~ rbt -u
automatically determines the existing review request to update. It+ suggests a pending review request by the current user in the current + repository, based on the request summary and description. ~ rbt -u
will attempt to determine the existing review request to update~ as a convenient alternative than specifying the request id using -r
.~ ~ If the summary and description exactly match those of an existing request,
~ the request is immediately updated. Otherwise, the user is prompted to confirm ~ a suggestion from a ranked list of potential matches. - rbt -u
suggests existing review request submitted by the logged in user- for the current repository based on the request summary and description. Reviewed at https://reviews.reviewboard.org/r/4699
- Testing Done:
-
+ -Tested with Git, Mercurial, and Bazaar using, with and without 'revision range'.
+ -Unit tests pass.
- Change Summary:
-
Rebase onto patch for r/4662.
- Depends On:
-
-
-
-
-
-
-
-
-
-
There's a lot of code repeated here. I'd suggest having the conditionals compute the revision only, and then do the whole execute () at the end of the function.
-
-
-
"Returns the ..."
Make sure the rest of the change is in that format. "Gets" doesn't mean it's returning anything it just means it's getting something from somewhere.
-
-
-
-
-
-
Parent branch of what? The docs should be explicit, so there's no uncertainty about what it's based off of.
-
"Returns"
Can you explain more what this function does? From the description, it's not immediately obvious what this data is or where the information is coming from.
-
You don't need the `` in the summaries. It's best not to specify the variable names in summaries, actually. Say something like "the provided revision range."
-
-
Terminology is "review requests", specifically. "requests" usually means something else, like an HTTP request.
Can you also update the variable names to be review_request, and not request?
-
-
-
-
-
-
-
The comments shouldn't go between the conditionals. Try rewriting to describe what's happening when it hits that conditional, and put them inside the body.
-
-
- Change Summary:
-
Fixed issues from previous patch.
- Depends On:
- Change Summary:
-
Added dependency.
-
Just about there. A few things left, plus some other stuff that didn't actually get changed from my previous review (mentioned as a reply to that review).
-
-
-
-
-
-
-