Hi,

It's upset that the diff is "empty." That doesn't necessarily mean there's
no diff content, but it may not have found anything that parsed as a valid
diff containing changed files.

Is it possible to share the diff with us?

How was the diff generated? What type of repository is this for?

Christian

On Wed, Feb 13, 2019 at 9:15 AM <adithy...@cloudplusinfotech.com> wrote:

> Hi,
>
> I need some help to resolve this issue
>
> I am trying to upload a diff file using python to a newly created  review
> request using RBTools-1.0.1.
> The review request gets created in the review board.The diff file upload
> is fails.
> Following is the code,however I am getting the error as following:
>
> **********************************
> from rbtools.api.client import RBClient
>
>
> client = RBClient('https://reviewserver',
>                   username='username',
>                   password='password')
> root = client.get_root()
>
> repos = root.get_repositories()
>
> if repos.num_items < 1:
>     raise Exception('No valid repositories.')
>
> repository = repos[0].id
> print(repository)
>
> review_request = root.get_review_requests().create(repository=repository)
>
> f = open("C:\\Users\\User\\Desktop\\Python\\f4.diff", mode="r")
> diff_contents = f.read()
> print(f)
> f.close()
>
> review_request.get_diffs().upload_diff(diff_contents,base_dir= '/')
> ***********************************
>
> Error Message:
>
>
> C:\Users\User\Desktop\Python>python reviewboard_Feb12.py
> 1
> <_io.TextIOWrapper name='C:\\Users\\User\\Desktop\\Python\\f4.diff'
> mode='r' encoding='cp1252'>
> Traceback (most recent call last):
>   File
> "C:\Users\User\AppData\Local\Programs\Python\Python37\lib\site-packages\rbtools\api\request.py",
> line 601, in make_request
>     request.url, body, headers, request.method))
>   File
> "C:\Users\User\AppData\Local\Programs\Python\Python37\lib\site-packages\rbtools\api\cache.py",
> line 209, in make_request
>     return self.urlopen(request)
>   File
> "C:\Users\User\AppData\Local\Programs\Python\Python37\lib\urllib\request.py",
> line 222, in urlopen
>     return opener.open(url, data, timeout)
>   File
> "C:\Users\User\AppData\Local\Programs\Python\Python37\lib\urllib\request.py",
> line 531, in open
>     response = meth(req, response)
>   File
> "C:\Users\User\AppData\Local\Programs\Python\Python37\lib\site-packages\rbtools\api\request.py",
> line 239, in http_response
>     response.info())
>   File
> "C:\Users\User\AppData\Local\Programs\Python\Python37\lib\urllib\request.py",
> line 569, in error
>     return self._call_chain(*args)
>   File
> "C:\Users\User\AppData\Local\Programs\Python\Python37\lib\urllib\request.py",
> line 503, in _call_chain
>     result = func(*args)
>   File
> "C:\Users\User\AppData\Local\Programs\Python\Python37\lib\urllib\request.py",
> line 649, in http_error_default
>     raise HTTPError(req.full_url, code, msg, hdrs, fp)
> urllib.error.HTTPError: HTTP Error 400: BAD REQUEST
>
> During handling of the above exception, another exception occurred:
>
> Traceback (most recent call last):
>   File "reviewboard_Feb12.py", line 24, in <module>
>     review_request.get_diffs().upload_diff(diff_contents,base_dir ='None')
>   File
> "C:\Users\User\AppData\Local\Programs\Python\Python37\lib\site-packages\rbtools\api\decorators.py",
> line 27, in request_method
>     *args, **kwargs)
>   File
> "C:\Users\User\AppData\Local\Programs\Python\Python37\lib\site-packages\rbtools\api\transport\sync.py",
> line 77, in execute_request_method
>     return self._execute_request(request)
>   File
> "C:\Users\User\AppData\Local\Programs\Python\Python37\lib\site-packages\rbtools\api\transport\sync.py",
> line 86, in _execute_request
>     rsp = self.server.make_request(request)
>   File
> "C:\Users\User\AppData\Local\Programs\Python\Python37\lib\site-packages\rbtools\api\request.py",
> line 603, in make_request
>     self.process_error(e.code, e.read())
>   File
> "C:\Users\User\AppData\Local\Programs\Python\Python37\lib\site-packages\rbtools\api\request.py",
> line 577, in process_error
>     rsp['err']['msg'])
> rbtools.api.errors.BadRequestError: The specified diff file is empty.
> (HTTP 400, API Error 219)
>
> ***********************************
>
>
>
>
> --
> Supercharge your Review Board with Power Pack:
> https://www.reviewboard.org/powerpack/
> Want us to host Review Board for you? Check out RBCommons:
> https://rbcommons.com/
> Happy user? Let us know! https://www.reviewboard.org/users/
> ---
> You received this message because you are subscribed to the Google Groups
> "Review Board Community" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to reviewboard+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>


-- 
Christian Hammond
President/CEO of Beanbag <https://www.beanbaginc.com/>
Makers of Review Board <https://www.reviewboard.org/>

-- 
Supercharge your Review Board with Power Pack: 
https://www.reviewboard.org/powerpack/
Want us to host Review Board for you? Check out RBCommons: 
https://rbcommons.com/
Happy user? Let us know! https://www.reviewboard.org/users/
--- 
You received this message because you are subscribed to the Google Groups 
"Review Board Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to reviewboard+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to