3431: 'rbt post' throws BadRequestError when wrong tracking branch is specified

bruce*****@gmai***** (Google Code) (Is this you? Claim this profile.)
June 20, 2014
What version are you running?
RBTools 0.6.1, RB 2.0.1

What steps will reproduce the problem?
1. git clone https://github.com/user/reviewboard
2. cd reviewboard && checkout release-2.0.x
3. rbt post --tracking-branch origin/release-1.0.x

What is the expected output? What do you see instead?
A user-friendly error should be displayed, but instead the client shows
'AttributeError: 'BadRequestError' object has no attribute 'decode''
and the server throws a LookupError.

What operating system are you using? What browser?
Windows 8.1 (client), Ubuntu 12.04 (server)

Please provide any additional information below.

Client log:
>>> Got API Error 105 (HTTP code 400): One or more fields had errors
>>> Error data: {u'fields': {u'path': [u'unknown encoding: ']}, u'stat': u'fail', u'err': {u'msg': u'One or more fields had errors', u'code': 105}}
Traceback (most recent call last):
  File "c:\Python27\Scripts\rbt-script.py", line 9, in <module>
    load_entry_point('RBTools==0.6.1', 'console_scripts', 'rbt')()
  File "C:\Python27\lib\site-packages\rbtools-0.6.1-py2.7.egg\rbtools\commands\main.py", line 134, in main
    command.run_from_argv([RB_MAIN, command_name] + args)
  File "C:\Python27\lib\site-packages\rbtools-0.6.1-py2.7.egg\rbtools\commands\__init__.py", line 416, in run_from_argv
    exit_code = self.main(*args) or 0
  File "C:\Python27\lib\site-packages\rbtools-0.6.1-py2.7.egg\rbtools\commands\post.py", line 784, in main
    submit_as=self.options.submit_as)
  File "C:\Python27\lib\site-packages\rbtools-0.6.1-py2.7.egg\rbtools\commands\post.py", line 543, in post_request
    error_msg.append(e.decode('utf-8') + u'\n')
AttributeError: 'BadRequestError' object has no attribute 'decode'

Server log:
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/ReviewBoard-2.0.1-py2.7.egg/reviewboard/webapi/resources/diff.py", line 292, in create
    request.FILES.get('parent_diff_path'))
  File "/usr/local/lib/python2.7/dist-packages/ReviewBoard-2.0.1-py2.7.egg/reviewboard/reviews/forms.py", line 116, in create
    history)
  File "/usr/local/lib/python2.7/dist-packages/ReviewBoard-2.0.1-py2.7.egg/reviewboard/diffviewer/forms.py", line 69, in create
    request=self.request)
  File "/usr/local/lib/python2.7/dist-packages/ReviewBoard-2.0.1-py2.7.egg/reviewboard/diffviewer/managers.py", line 156, in create_from_upload
    save=save)
  File "/usr/local/lib/python2.7/dist-packages/ReviewBoard-2.0.1-py2.7.egg/reviewboard/diffviewer/managers.py", line 173, in create_from_data
    diff_file_contents, repository.get_encoding_list())
  File "/usr/local/lib/python2.7/dist-packages/ReviewBoard-2.0.1-py2.7.egg/reviewboard/diffviewer/diffutils.py", line 50, in convert_to_unicode
    return e, six.text_type(s, e)
LookupError: unknown encoding:
#1 bruce*****@gmai***** (Google Code) (Is this you? Claim this profile.)
The error goes away when filling in the repository encoding type with 'utf-8', so this might be one of the problems fixed in RB 2.0.2.
david
#2 david
Yeah, the Review Board error is fixed in 2.0.2, and the RBTools error will be fixed in the next 0.6 release.
  • +Fixed