Bug fix: post-review creates unpublishable draft on submitted review requests

Review Request #3085 — Created April 29, 2012 and submitted

Information

RBTools

Reviewers

This fixes Issue:2549. 
I went with the first suggestion (not allowing updates), but I can also look into re-opening the issue upon publishing, if everyone likes that option better.
manual
ran rbtools/tests.py (although they were mostly unrelated)
Description From Last Updated

I'm not sure if this is the condition we should use. ['status'] is one of 'discarded', 'pending', or 'submitted'. I …

SM smacleod

The indentation here looks a little funky to me, maybe you could try something like this: die("Review request %s is …

SM smacleod

One possible tiny optimization: review_request_status = server.get_review_request(options.rid)['status'] This way you'll avoid a double dict look-up.

ME medanat

Couple small syntax-related comments. The text looks nicer if the space is after "is" instead of before "not". The text …

chipx86chipx86

Can you add an instruction here that if the user really wants to update it, they can reopen the review …

daviddavid
SM
  1. 
      
  2. rbtools/postreview.py (Diff revision 1)
     
     
    Show all issues
    I'm not sure if this is the condition we should use.
    
    ['status'] is one of 'discarded', 'pending', or 'submitted'. I believe there is
    a valid use case where you would upload a new diff to a 'discarded' request,
    and then re-open it. As it stands, this change would require you to re-open
    the request before uploading the diff.
  3. rbtools/postreview.py (Diff revision 1)
     
     
     
     
    Show all issues
    The indentation here looks a little funky to me, maybe you could try something like this:
    
    die("Review request %s is marked as %s. Updating is" 
        "allowed only on pending requests." % (
            options.rid, review_request['status']))
  4. 
      
BO
SM
  1. Ship It!
  2. 
      
ME
  1. Looks good to me, one tiny thing.
  2. rbtools/postreview.py (Diff revision 2)
     
     
     
     
     
     
     
    Show all issues
    One possible tiny optimization:
    
    review_request_status = server.get_review_request(options.rid)['status']
    
    This way you'll avoid a double dict look-up.
    1. You can't exactly do this since `review_request` is needed by later code. You could do:
      
          review_request = server.get_review_request(options.rid)
          status = review_request['status']
      
      To be honest though, I doubt there is a measurable performance gain from this, unless
      of course Python is much slower than I previously believed ;)
    2. Yeah your solution seems more applicable.
      
      Dict look-ups are pretty fast, but its still better style to do the same look up only once.
      
      But you're right, its not a measurable performance hit, especially for a post-review request as this code will only run once per post-review.
    3. I agree with both of you :)
      Actually, I was aware of the double look-up but decided to be lazy since, as Steve mentioned, it's not that great of a performance gain.
      Still, I hope the new diff makes everyone happy :D
  3. 
      
BO
ME
  1. Ship It!
  2. 
      
chipx86
  1. 
      
  2. rbtools/postreview.py (Diff revision 3)
     
     
     
     
    Show all issues
    Couple small syntax-related comments.
    
    The text looks nicer if the space is after "is" instead of before "not". The text is nicely aligned on the left that way.
    
    For the format parameters, the "(" should be right up against "options.rid". It can be on the following line, like:
    
    
        "blah blah" %
        (options.rid, status)
  3. 
      
BO
david
  1. 
      
  2. rbtools/postreview.py (Diff revision 4)
     
     
     
    Show all issues
    Can you add an instruction here that if the user really wants to update it, they can reopen the review using the web interface?
  3. 
      
BO
david
  1. Ship It!
  2. 
      
BO
Review request changed
Status:
Completed
Change Summary:
Pushed to master (45c6ea1). Thanks!