2632: Cannot upload a diff created via svn

Dmit*****@gmai***** (Google Code) (Is this you? Claim this profile.)
Aug. 11, 2013
What version are you running?
1.6.7.1

What steps will reproduce the problem?
1. I created a diff from svn (diff contains info about one file that was created, something like that:

Index: modules/compositionmng/server/utils/AuditLogUtils.java
===================================================================
--- modules/compositionmng/server/utils/AuditLogUtils.java	(revision )
+++ modules/compositionmng/server/utils/AuditLogUtils.java	(revision )
@@ -0,0 +1,7@@
+package com.server.utils;
+
+import org.apache.log4j.Logger;
+
+public class AuditLogUtils {
+    private static Logger log = Logger.getLogger(AuditLogUtils.class);
+}

2. Then I tried to upload the diff and got an error: 

2012-06-08 16:55:48,066 - ERROR - Internal Server Error: /reviews/api/review-requests/5/diffs/
Traceback (most recent call last):
  File "/usr/lib/python2.6/site-packages/Django-1.3.1-py2.6.egg/django/core/handlers/base.py", line 178, in get_response
    response = middleware_method(request, response)
  File "/usr/lib/python2.6/site-packages/Django-1.3.1-py2.6.egg/django/middleware/http.py", line 15, in process_response
    response['Content-Length'] = str(len(response.content))
  File "/usr/lib/python2.6/site-packages/Djblets-0.6.18-py2.6.egg/djblets/webapi/core.py", line 281, in _get_content
    content = adapter.encode(self.api_data, request=self.request)
  File "/usr/lib/python2.6/site-packages/Djblets-0.6.18-py2.6.egg/djblets/webapi/core.py", line 88, in encode
    return super(JSONEncoderAdapter, self).encode(o)
  File "/usr/lib64/python2.6/site-packages/simplejson/encoder.py", line 200, in encode
    chunks = self.iterencode(o, _one_shot=True)
  File "/usr/lib64/python2.6/site-packages/simplejson/encoder.py", line 260, in iterencode
    return _iterencode(o, 0)
  File "/usr/lib/python2.6/site-packages/Djblets-0.6.18-py2.6.egg/djblets/webapi/core.py", line 99, in default
    raise TypeError("%r is not JSON serializable" % (o,))
TypeError: <Revision: HEAD> is not JSON serializable

The error appears only when I upload diff that contains info about adding files, otherwise it works properly.
chipx86
#1 chipx86
So you're using plain SVN? Which version? And it's a newly created, uncommitted file?
  • +NeedInfo
  • +Component-SCMTools
    +Milestone-Release1.6.x
#2 Dmit*****@gmai***** (Google Code) (Is this you? Claim this profile.)
I installed subversion 1.6.11 and pysvn 1.7.2-3.e16 on my server. As a client I use subversion 1.7.4, but I think version doesn't matter because it should be pre-commit code review, so I just make a diff (I made the diff with Intellij, also I tried to make the diff another way - via tortoiseSvn and it had the same problem). Regarding to your question about file - yes, it's new uncommited file.

Thanks 
#3 Dmit*****@gmai***** (Google Code) (Is this you? Claim this profile.)
Hello, guys. Are there any suggestions?

Thanks
david
#4 david
Can you use post-review to create your diff?
#5 Dmit*****@gmai***** (Google Code) (Is this you? Claim this profile.)
Unfortunately no, for some reasons. But I tried to use it and as far as I understood it doesn't have a possibility to create diff without publishing a review. Am I right? 
If post-review tool works for such a case, could you please provide me an info why it doesn't work for plain diff and possibly I'll find the solution.
chipx86
#6 chipx86
I'm not sure what you mean about publishing a review. It's the same thing as using the New Review Request form, but works around some kinks and automates some steps.

Try using the actual command line 'svn diff', and not IntelliJ or TortoiseSVN. Preferably, though, use post-review.
#7 Dmit*****@gmai***** (Google Code) (Is this you? Claim this profile.)
I tried to use "svn diff" and got the same error

2012-06-14 10:00:32,866 - DEBUG - DiffParser.parse: Beginning parse of diff, size = 94423
2012-06-14 10:00:32,879 - DEBUG - DiffParser.parse: Finished parsing diff.
2012-06-14 10:00:48,392 - ERROR - Internal Server Error: /reviews/api/review-requests/5/diffs/
Traceback (most recent call last):
  File "/usr/lib/python2.6/site-packages/Django-1.3.1-py2.6.egg/django/core/handlers/base.py", line 178, in get_response
    response = middleware_method(request, response)
  File "/usr/lib/python2.6/site-packages/Django-1.3.1-py2.6.egg/django/middleware/http.py", line 15, in process_response
    response['Content-Length'] = str(len(response.content))
  File "/usr/lib/python2.6/site-packages/Djblets-0.6.18-py2.6.egg/djblets/webapi/core.py", line 281, in _get_content
    content = adapter.encode(self.api_data, request=self.request)
  File "/usr/lib/python2.6/site-packages/Djblets-0.6.18-py2.6.egg/djblets/webapi/core.py", line 88, in encode
    return super(JSONEncoderAdapter, self).encode(o)
  File "/usr/lib64/python2.6/site-packages/simplejson/encoder.py", line 200, in encode
    chunks = self.iterencode(o, _one_shot=True)
  File "/usr/lib64/python2.6/site-packages/simplejson/encoder.py", line 260, in iterencode
    return _iterencode(o, 0)
  File "/usr/lib/python2.6/site-packages/Djblets-0.6.18-py2.6.egg/djblets/webapi/core.py", line 99, in default
    raise TypeError("%r is not JSON serializable" % (o,))
TypeError: <Revision: HEAD> is not JSON serializable

#8 phil*****@gmai***** (Google Code) (Is this you? Claim this profile.)
Hey,

I'm having this issue as well. However for me, I am trying to add support for a new repository type (my company's enterprisey repo). I am using the post-review tool, here's the output with --debug


>>> RBTools 0.4.1
>>> Home = /users/phsavoie
hello
acme -ver == true
>>> HTTP GETting api/
>>> HTTP GETting http://ott-pd-vs-001:8000/api/info/
>>> Using the new web API
>>> Attempting to create review request on /nobackup/phsavoie/crs-satellite-431 for None
>>> HTTP POSTing to http://ott-pd-vs-001:8000/api/review-requests/: {'repository': '/nobackup/phsavoie/crs-satellite-431'}
>>> Review request created
>>> Uploading diff, size: 124020
>>> HTTP POSTing to http://ott-pd-vs-001:8000/api/review-requests/33/diffs/: {'basedir': '/nobackup/phsavoie/crs-satellite-431'}
>>> Got HTTP error: 500: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
 <head>
  <title>500 - Internal Server Error | Review Board</title>
 </head>
 <body>
  <h1>Something broke! (Error 500)</h1>
  <p>
   It appears something broke when you tried to go to here. This is either
   a bug in Review Board or a server configuration error. Please report
   this to your administrator.
  </p>
 </body>
</title>


Error uploading diff

Your review request still exists, but the diff is not attached.
david
#9 david
Something about your svn binary is pretty weird (We've only seen "(revision )" from IntelliJ IDEA before). That said, I think we can work around it. I've pushed a fix for this to master (95cf9c1). It will ship in 1.8.0.
  • -NeedInfo
    +Fixed