• 
      

    Fix a review request issue counter error with failed draft publishing.

    Review Request #7045 — Created March 11, 2015 and submitted

    Information

    Review Board
    release-2.0.x
    e517094...

    Reviewers

    We've had a number of reports of -1 issue counter values, with no solid
    repro case. The reproduction case, it turns out, involves failing to
    publish a draft.
    
    When we attempt to publish a draft on an already-public review request,
    we first decrement counters, so that any groups or users who will be
    removed in the draft will have their counters decremented. The idea is
    that we'd then increment them again after the draft is publish. If the
    draft fails to publish, we never get that opportunity.
    
    We now catch any exceptions and re-increment the values before
    re-raising the exception.
    
    While here, I made NotModifiedError a PublishError. Originally, this was
    part of my fix, but I decided to make the handling more generic. Anyway,
    this is probably the right thing to do.

    The new unit tests failed with counters being off by 1, without this fix.
    With the fix, they had the expected values.

    All unit tests pass.

    Description From Last Updated

    Blank line between these.

    brenniebrennie
    reviewbot
    1. Tool: Pyflakes
      Processed Files:
          reviewboard/webapi/resources/review_request_draft.py
          reviewboard/reviews/tests.py
          reviewboard/reviews/errors.py
          reviewboard/reviews/models/review_request.py
      
      
      
      Tool: PEP8 Style Checker
      Processed Files:
          reviewboard/webapi/resources/review_request_draft.py
          reviewboard/reviews/tests.py
          reviewboard/reviews/errors.py
          reviewboard/reviews/models/review_request.py
      
      
    2. 
        
    brennie
    1. 
        
    2. reviewboard/reviews/errors.py (Diff revision 1)
       
       
       
      Show all issues

      Blank line between these.

    3. 
        
    chipx86
    Review request changed
    Status:
    Completed
    Change Summary:
    Pushed to release-2.0.x (dfeeea1)