Fish Trophy

André Klitzing got a fish trophy!

Avoid error message on "New Review Request page" for Mercurial < 3.9

Review Request #8778 - Created Feb. 24, 2017 and submitted

André Klitzing
Review Board
release-2.5.x
4524
71c8c64...
reviewboard
seb
If the repository hosting uses a Mercurial 3.7 it is possible to
get branches (/json-branches/) with the JSON API of hgweb. But it leads
to an error if reviewboard tries to fetch "/json-log/?rev=" as
it is not implemented.

Also avoid an error if Mercurial is really old and does not support
to get branches in JSON style with "/json-branches/".

Bugs closed: 4524

Opened "New Review Request page" and check if branch and commit list
works properly and does not contain errors.

Tested versions: 2.6.2, 3.0, 3.7.3, 4.1

  • 0
  • 0
  • 7
  • 0
  • 7
Description From Last Updated
Review Bot
  1. Tool: Pyflakes
    Processed Files:
        reviewboard/scmtools/hg.py
    
    
    
    Tool: PEP8 Style Checker
    Processed Files:
        reviewboard/scmtools/hg.py
    
    
  2. 
      
Sebastian Unger
  1. 
      
  2. reviewboard/scmtools/hg.py (Diff revision 1)
     
     
     
     
     
     
     
     

    This doesn't quite look right to me, but I'm very unfamiliar with the code. In line 321 contents is treated as a json string which makes me believe it is simply the body of the HTTP response. However, in line 315 you are using in as though it was a dictionary?

    1. Yeah, you are right.... I already try to get the http header.

  3. reviewboard/scmtools/hg.py (Diff revision 1)
     
     

    A similar problem here. When I look at the original 3.7 map file for the json style, it looks to me as though the 'not yet implemented' is returned as a json string. So it would seem much safer to test for the returned content-type in whatever way is correct (see comment above) and then do something like

    json_contents = json.loads(contents)
    if not json_contents == 'not yet implemented'
    

    or similar. Otherwise you ran into trouble if the response has any characters escaped for instance (although I don't know why it ever would).

    1. Well, it is bad to check for a string here, right. But the Content-Type is incorrect and the result is plaintext "not yet implemented". Maybe it is better to just check the body size. ;-)

  4. 
      
André Klitzing
Review Bot
  1. Tool: Pyflakes
    Processed Files:
        reviewboard/scmtools/hg.py
        reviewboard/scmtools/core.py
    
    
    
    Tool: PEP8 Style Checker
    Processed Files:
        reviewboard/scmtools/hg.py
        reviewboard/scmtools/core.py
    
    
  2. reviewboard/scmtools/core.py (Diff revision 2)
     
     
    Col: 80
     E501 line too long (90 > 79 characters)
    
  3. 
      
André Klitzing
André Klitzing
Review Bot
  1. Tool: Pyflakes
    Processed Files:
        reviewboard/scmtools/hg.py
        reviewboard/scmtools/core.py
    
    
    
    Tool: PEP8 Style Checker
    Processed Files:
        reviewboard/scmtools/hg.py
        reviewboard/scmtools/core.py
    
    
  2. 
      
David Trowbridge
  1. 
      
  2. reviewboard/scmtools/core.py (Diff revision 3)
     
     

    "type" is a reserved word in python. Can you change this variable name?

  3. reviewboard/scmtools/core.py (Diff revision 3)
     
     
     

    Add a blank line between these two.

  4. reviewboard/scmtools/core.py (Diff revision 3)
     
     
     

    Add a blank line between these two.

  5. reviewboard/scmtools/hg.py (Diff revision 3)
     
     
     

    Should we do the check here before json.loads?

  6. 
      
André Klitzing
Review Bot
  1. Tool: Pyflakes
    Processed Files:
        reviewboard/scmtools/hg.py
        reviewboard/scmtools/core.py
    
    
    
    Tool: PEP8 Style Checker
    Processed Files:
        reviewboard/scmtools/hg.py
        reviewboard/scmtools/core.py
    
    
  2. 
      
David Trowbridge
  1. Ship It!
  2. 
      
André Klitzing
Review request changed

Status: Closed (submitted)

Change Summary:

Pushed to release-2.5.x (8eba94c)
Loading...