Re: Using post-review in svn's post-commit hook

2009-08-20 Thread Christian Hammond
Hi Rujia,

This might be fixed in the nightlies. Can you try a nightly build from
http://downloads.review-board.org/nightlies/ and see if this fixes the
problem?

Christian

-- 
Christian Hammond - chip...@chipx86.com
Review Board - http://www.review-board.org
VMware, Inc. - http://www.vmware.com


On Wed, Aug 19, 2009 at 9:27 PM, rujia rujia@gmail.com wrote:


 Hi!

 I'm writing a script to automatically post a review request for every
 revision, using svn's post-commit hook. When I run this:

 post-review -d -p --server=http://myrbserver --target-group=xxx --
 revision-range=xxx --submit-as=someone --username=submitter --
 password=submitter --repository-url=/directory/of/my/working/copy

 I got the following message:

  svn info /directory/of/my/working/copy
  repository info: Path: http://mysvnserver Base path: /, Supports
 changesets: False
  svn diff --diff-cmd=diff http://mysvnserver/@xxx
 http://mysvnserver/@HEAD
 Password for 'rujialiu':

 (I've logged in as user rujialiu. My svn account is also named
 rujialiu)

 Even if I entered my password, nothing happended (actually, a new line
 comes in, and I can enter some visible text). I had to Ctrl-C.

 My goal is to automate this one in my post-commit hook of svn, in the
 repository machine, so I can't enter password everytime.

 Thanks in advance!

 SVN version: 1.4.6 (auth with apache 2.2)
 installed both ReviewBoard and RB-tools via easy_install, less than 1
 week ago.
 post-review --version gets 0.8

 ReviewBoard is installed successfully at http://myrbserver, at least I
 can login as admin and add users, groups etc, and has already added
 the svn repository http://mysvnserver

 - Rujia

 


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
reviewboard group.
To post to this group, send email to reviewboard@googlegroups.com
To unsubscribe from this group, send email to 
reviewboard+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/reviewboard?hl=en
-~--~~~~--~~--~--~---



Re: Using post-review in svn's post-commit hook

2009-08-20 Thread Rujia Liu
Hi!

Thanks, Christian. I've updated to the newest nightly build.

Now I have found the reason. Thanks to the -d option, I saw the last command
that post-review has executed:
svn diff --diff-cmd=diff http://mysvnserver/@xxx http://mysvnserver/@HEAD

I manually executed it and it asked me for the password, so i know that it
is NOT post-review's fault - our project is restricted to internal use only,
so accessing http://mysvnserver needs password

I managed overcome this but another error occurred:

 svn info /directory/of/my/working/copy
 repository info: Path: http://mysvnserver, Base path: /, Supports
changesets: False
 svn diff --diff-cmd=diff http://mysvnser...@18444 http://mysvnserver
@HEAD
 Looking for 'http://myrbserver http://mysvnserver//' cookie in
/xxx/.post-review-cookies.txt
 Loaded valid cookie -- no login required
 Attempting to create review request for None
 HTTP GETting /api/json/repositories/
 HTTP GETting /api/json/repositories/1/info/
 repository info: Path: http://mysvnserver, Base path: /, Supports
changesets: False
 Submitting the review request as zzz
 HTTP POSTing to http://myrbserver 
 http://mysvnserver//api/json/reviewrequests/new/:
{'repository_path': u'http://mysvnserver', 'submit_as': 'zzz'}
 Review request created
 Attempting to set field 'target_groups' to 'ggg' for review request '6'
 HTTP POSTing to http://myrbserver 
 http://mysvnserver//api/json/reviewrequests/6/draft/set/:
{'target_groups': 'ggg'}
 !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
  title500 - Internal Server Error | Review Board/title
 /head
 body
  h1Something 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

Unable to access http://myrbserver
http://mysvnserver//api/json/reviewrequests/6/draft/set/.
The host path may be invalid
HTTP Error 500: Internal Server Error

Then I logged in as admin and saw a review request, unpublished. As seen
above, there is something wrong when setting target_groups of this
request, it then got interrupted, so diff file is not uploaded.

the target_groups I used contains a hyphen -, but I don't think it's
invalid because I've successfully created some group in the ReviewBoard
server (I've also created relavent users and set appropriate permissions).

Is there anyway to get more debug information (like post-review -d) rather
than a poor Error 500 page? Thanks!

- Rujia

On Thu, Aug 20, 2009 at 2:46 PM, Christian Hammond chip...@chipx86.comwrote:

 Hi Rujia,

 This might be fixed in the nightlies. Can you try a nightly build from
 http://downloads.review-board.org/nightlies/ and see if this fixes the
 problem?

 Christian

 --
 Christian Hammond - chip...@chipx86.com
 Review Board - http://www.review-board.org
 VMware, Inc. - http://www.vmware.com



 On Wed, Aug 19, 2009 at 9:27 PM, rujia rujia@gmail.com wrote:


 Hi!

 I'm writing a script to automatically post a review request for every
 revision, using svn's post-commit hook. When I run this:

 post-review -d -p --server=http://myrbserver --target-group=xxx --
 revision-range=xxx --submit-as=someone --username=submitter --
 password=submitter --repository-url=/directory/of/my/working/copy

 I got the following message:

  svn info /directory/of/my/working/copy
  repository info: Path: http://mysvnserver Base path: /, Supports
 changesets: False
  svn diff --diff-cmd=diff http://mysvnserver/@xxx
 http://mysvnserver/@HEAD
 Password for 'rujialiu':

 (I've logged in as user rujialiu. My svn account is also named
 rujialiu)

 Even if I entered my password, nothing happended (actually, a new line
 comes in, and I can enter some visible text). I had to Ctrl-C.

 My goal is to automate this one in my post-commit hook of svn, in the
 repository machine, so I can't enter password everytime.

 Thanks in advance!

 SVN version: 1.4.6 (auth with apache 2.2)
 installed both ReviewBoard and RB-tools via easy_install, less than 1
 week ago.
 post-review --version gets 0.8

 ReviewBoard is installed successfully at http://myrbserver, at least I
 can login as admin and add users, groups etc, and has already added
 the svn repository http://mysvnserver

 - Rujia




 


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
reviewboard group.
To post to this group, send email to reviewboard@googlegroups.com
To unsubscribe from this group, send email to 
reviewboard+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/reviewboard?hl=en
-~--~~~~--~~--~--~---



Re: Using post-review in svn's post-commit hook

2009-08-20 Thread Christian Hammond
Hi Rujia,

You can get more detailed debugging information by setting DEBUG = True in
Review Board's conf/settings_local.py. Then restart the web server and try
again. You'll get an HTML error dump with a backtrace.

We can take a look at the error dump if the problem isn't obvious. It would
be good to have a bug report on it once we figure it out.

It's best to set DEBUG back to False once you've figured out the cause, for
performance reasons.

Christian

-- 
Christian Hammond - chip...@chipx86.com
Review Board - http://www.review-board.org
VMware, Inc. - http://www.vmware.com


On Thu, Aug 20, 2009 at 2:36 AM, Rujia Liu rujia@gmail.com wrote:

 Hi!

 Thanks, Christian. I've updated to the newest nightly build.

 Now I have found the reason. Thanks to the -d option, I saw the last
 command that post-review has executed:
 svn diff --diff-cmd=diff http://mysvnserver/@xxx http://mysvnserver/@HEAD

 I manually executed it and it asked me for the password, so i know that it
 is NOT post-review's fault - our project is restricted to internal use only,
 so accessing http://mysvnserver needs password

 I managed overcome this but another error occurred:

  svn info /directory/of/my/working/copy
  repository info: Path: http://mysvnserver, Base path: /, Supports
 changesets: False
   svn diff --diff-cmd=diff http://mysvnser...@18444 http://mysvnserver
 @HEAD
  Looking for 'http://myrbserver http://mysvnserver//' cookie in
 /xxx/.post-review-cookies.txt
  Loaded valid cookie -- no login required
  Attempting to create review request for None
  HTTP GETting /api/json/repositories/
  HTTP GETting /api/json/repositories/1/info/
  repository info: Path: http://mysvnserver, Base path: /, Supports
 changesets: False
  Submitting the review request as zzz
  HTTP POSTing to http://myrbserver 
  http://mysvnserver//api/json/reviewrequests/new/:
 {'repository_path': u'http://mysvnserver', 'submit_as': 'zzz'}
  Review request created
  Attempting to set field 'target_groups' to 'ggg' for review request '6'
  HTTP POSTing to http://myrbserver 
  http://mysvnserver//api/json/reviewrequests/6/draft/set/:
 {'target_groups': 'ggg'}
  !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
   title500 - Internal Server Error | Review Board/title
  /head
  body
   h1Something 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

 Unable to access http://myrbserver 
 http://mysvnserver//api/json/reviewrequests/6/draft/set/.
 The host path may be invalid
 HTTP Error 500: Internal Server Error

 Then I logged in as admin and saw a review request, unpublished. As seen
 above, there is something wrong when setting target_groups of this
 request, it then got interrupted, so diff file is not uploaded.

 the target_groups I used contains a hyphen -, but I don't think it's
 invalid because I've successfully created some group in the ReviewBoard
 server (I've also created relavent users and set appropriate permissions).

 Is there anyway to get more debug information (like post-review -d) rather
 than a poor Error 500 page? Thanks!

 - Rujia


 On Thu, Aug 20, 2009 at 2:46 PM, Christian Hammond chip...@chipx86.comwrote:

 Hi Rujia,

 This might be fixed in the nightlies. Can you try a nightly build from
 http://downloads.review-board.org/nightlies/ and see if this fixes the
 problem?

 Christian

 --
 Christian Hammond - chip...@chipx86.com
 Review Board - http://www.review-board.org
 VMware, Inc. - http://www.vmware.com



 On Wed, Aug 19, 2009 at 9:27 PM, rujia rujia@gmail.com wrote:


 Hi!

 I'm writing a script to automatically post a review request for every
 revision, using svn's post-commit hook. When I run this:

 post-review -d -p --server=http://myrbserver --target-group=xxx --
 revision-range=xxx --submit-as=someone --username=submitter --
 password=submitter --repository-url=/directory/of/my/working/copy

 I got the following message:

  svn info /directory/of/my/working/copy
  repository info: Path: http://mysvnserver Base path: /, Supports
 changesets: False
  svn diff --diff-cmd=diff http://mysvnserver/@xxx
 http://mysvnserver/@HEAD
 Password for 'rujialiu':

 (I've logged in as user rujialiu. My svn account is also named
 rujialiu)

 Even if I entered my password, nothing happended (actually, a new line
 comes in, and I can enter some visible text). I had to Ctrl-C.

 My goal is to automate this one in my post-commit hook of svn, in the
 repository machine, so I can't enter password everytime.

 Thanks in advance!

 SVN version: 1.4.6 (auth with apache 2.2)
 installed both ReviewBoard and RB-tools via easy_install, less than 1
 week ago.
 post-review --version gets 0.8

 ReviewBoard is installed successfully at 

Re: Using post-review in svn's post-commit hook

2009-08-20 Thread Rujia Liu
Hi!

Oops, I didn't realize that ReviewBoard sent me an email.

Notice that I'm NOT using the nightly built ReviewBoard (I just used
easy_install ReviewBoard). Is that because attribute target_groups has
been renamed?

- Rujia

= Email begins ==

Title: [Django] Error (EXTERNAL IP): /api/json/reviewrequests/6/draft/set/

Content:
Traceback (most recent call last):

 File
/usr/lib/python2.5/site-packages/Django-1.1-py2.5.egg/django/core/handlers/base.py,
line 92, in get_response
   response = callback(request, *callback_args, **callback_kwargs)

 File
/usr/lib/python2.5/site-packages/Django-1.1-py2.5.egg/django/views/decorators/cache.py,
line 44, in _wrapped_view_func
   response = view_func(request, *args, **kwargs)

 File
/usr/lib/python2.5/site-packages/Djblets-0.5.1-py2.5.egg/djblets/webapi/decorators.py,
line 32, in _checklogin
   response = view_func(request, *args, **kwargs)

 File
/usr/lib/python2.5/site-packages/Django-1.1-py2.5.egg/django/views/decorators/http.py,
line 37, in inner
   return func(request, *args, **kwargs)

 File
/usr/lib/python2.5/site-packages/ReviewBoard-1.0.1-py2.5.egg/reviewboard/webapi/json.py,
line 872, in review_request_draft_set
   request.POST[field_name])

 File
/usr/lib/python2.5/site-packages/ReviewBoard-1.0.1-py2.5.egg/reviewboard/webapi/json.py,
line 762, in _set_draft_field_data
   target = getattr(draft, field_name)

AttributeError: 'WebAPIResponseError' object has no attribute
'target_groups'


ModPythonRequest
path:/api/json/reviewrequests/6/draft/set/,
GET:QueryDict: {},
POST:QueryDict: {u'target_groups': [u'ggg']},
COOKIES:{'rbsessionid': 'd4239c2df97334b14da98281a13ff72f'},
META:{'AUTH_TYPE': None,
 'CONTENT_LENGTH': 0L,
 'CONTENT_TYPE': None,
 'GATEWAY_INTERFACE': 'CGI/1.1',
 'HTTP_ACCEPT_ENCODING': 'identity',
 'HTTP_CONNECTION': 'close',
 'HTTP_CONTENT_LENGTH': '149',
 'HTTP_CONTENT_TYPE': 'multipart/form-data;
boundary=192.168.1.254.0.4112.1250759306.135.2',
 'HTTP_COOKIE': 'rbsessionid=d4239c2df97334b14da98281a13ff72f',
 'HTTP_HOST': 'myrbserver',
 'HTTP_USER_AGENT': 'post-review/0.8',
 'PATH_INFO': u'/api/json/reviewrequests/6/draft/set/',
 'PATH_TRANSLATED': None,
 'QUERY_STRING': None,
 'REMOTE_ADDR': '127.0.0.1',
 'REMOTE_HOST': None,
 'REMOTE_IDENT': None,
 'REMOTE_USER': None,
 'REQUEST_METHOD': 'POST',
 'SCRIPT_NAME': '',
 'SERVER_NAME': 'myrbserver',
 'SERVER_PORT': 80,
 'SERVER_PROTOCOL': 'HTTP/1.1',
 'SERVER_SOFTWARE': 'mod_python'}

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
reviewboard group.
To post to this group, send email to reviewboard@googlegroups.com
To unsubscribe from this group, send email to 
reviewboard+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/reviewboard?hl=en
-~--~~~~--~~--~--~---



Re: Using post-review in svn's post-commit hook

2009-08-20 Thread Christian Hammond
Looks like we're not properly checking whether there's an error and assuming
it's a draft. Certainly a bug. If you can file this backtrace in a bug
report, that would be helpful.

The problem is that the user specified doesn't have permission to modify
that review request. The code that checks that is returning a
WebAPIResponseError, but the code calling the function that received that as
a return value isn't checking to see if it got an error response.

Is the username and password you're using that of the user who submitted the
code, or is it a special user with the special permissions? See
http://review-board.org/docs/manual/dev/users/tools/post-review/#automatingpost-review

Christian

-- 
Christian Hammond - chip...@chipx86.com
Review Board - http://www.review-board.org
VMware, Inc. - http://www.vmware.com


On Thu, Aug 20, 2009 at 2:46 AM, Rujia Liu rujia@gmail.com wrote:

 Hi!

 Oops, I didn't realize that ReviewBoard sent me an email.

 Notice that I'm NOT using the nightly built ReviewBoard (I just used
 easy_install ReviewBoard). Is that because attribute target_groups has
 been renamed?

 - Rujia

 = Email begins ==

 Title: [Django] Error (EXTERNAL IP): /api/json/reviewrequests/6/draft/set/

 Content:
 Traceback (most recent call last):

  File
 /usr/lib/python2.5/site-packages/Django-1.1-py2.5.egg/django/core/handlers/base.py,
 line 92, in get_response
response = callback(request, *callback_args, **callback_kwargs)

  File
 /usr/lib/python2.5/site-packages/Django-1.1-py2.5.egg/django/views/decorators/cache.py,
 line 44, in _wrapped_view_func
response = view_func(request, *args, **kwargs)

  File
 /usr/lib/python2.5/site-packages/Djblets-0.5.1-py2.5.egg/djblets/webapi/decorators.py,
 line 32, in _checklogin
response = view_func(request, *args, **kwargs)

  File
 /usr/lib/python2.5/site-packages/Django-1.1-py2.5.egg/django/views/decorators/http.py,
 line 37, in inner
return func(request, *args, **kwargs)

  File
 /usr/lib/python2.5/site-packages/ReviewBoard-1.0.1-py2.5.egg/reviewboard/webapi/json.py,
 line 872, in review_request_draft_set
request.POST[field_name])

  File
 /usr/lib/python2.5/site-packages/ReviewBoard-1.0.1-py2.5.egg/reviewboard/webapi/json.py,
 line 762, in _set_draft_field_data
target = getattr(draft, field_name)

 AttributeError: 'WebAPIResponseError' object has no attribute
 'target_groups'


 ModPythonRequest
 path:/api/json/reviewrequests/6/draft/set/,
 GET:QueryDict: {},
 POST:QueryDict: {u'target_groups': [u'ggg']},
 COOKIES:{'rbsessionid': 'd4239c2df97334b14da98281a13ff72f'},
 META:{'AUTH_TYPE': None,
  'CONTENT_LENGTH': 0L,
  'CONTENT_TYPE': None,
  'GATEWAY_INTERFACE': 'CGI/1.1',
  'HTTP_ACCEPT_ENCODING': 'identity',
  'HTTP_CONNECTION': 'close',
  'HTTP_CONTENT_LENGTH': '149',
  'HTTP_CONTENT_TYPE': 'multipart/form-data;
 boundary=192.168.1.254.0.4112.1250759306.135.2',
  'HTTP_COOKIE': 'rbsessionid=d4239c2df97334b14da98281a13ff72f',
  'HTTP_HOST': 'myrbserver',
  'HTTP_USER_AGENT': 'post-review/0.8',
  'PATH_INFO': u'/api/json/reviewrequests/6/draft/set/',
  'PATH_TRANSLATED': None,
  'QUERY_STRING': None,
  'REMOTE_ADDR': '127.0.0.1',
  'REMOTE_HOST': None,
  'REMOTE_IDENT': None,
  'REMOTE_USER': None,
  'REQUEST_METHOD': 'POST',
  'SCRIPT_NAME': '',
  'SERVER_NAME': 'myrbserver',
  'SERVER_PORT': 80,
  'SERVER_PROTOCOL': 'HTTP/1.1',
  'SERVER_SOFTWARE': 'mod_python'}



 


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
reviewboard group.
To post to this group, send email to reviewboard@googlegroups.com
To unsubscribe from this group, send email to 
reviewboard+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/reviewboard?hl=en
-~--~~~~--~~--~--~---



Re: Using post-review in svn's post-commit hook

2009-08-20 Thread Rujia Liu
Hi!

Finally it worked. I've carefully read the automatingpost-review section,
but I misunderstood some permission.
I still don't think I understand it now, but at least, when I assign
everything to the logged user (who submits on be half of another user), it
worked.

Some suggestions:
1. The permission box is rather small, so actually I can't see the full
description of each permission (I can't scale it, nor can I scroll it
horizontally)
2. If post-review reports something like xxx permission expected, it'll be
more helpful :)
3. I've noticed that the svn repository URL must match EXACTLY. for example,
if I write http://server/path somewhere but http://server/path/  somewhere
else, post-review will report something like URL not matching.

BTW: still needs reporting backtrace? (just to confirm: you mean the
backtrace i've already attached?)

Now the whole process goes smooth manually. I'll start writing the automated
script tomorrow. Thanks again, Christian!

There is another question: is it possible to TRANSPARENTLY automate
pre-commit reviews? I mean, coders still use svn ci to commit, then
pre-commit hooks fetch the diff file, generate review request, then after a
reviewer accepts this diff file, it'll be automatically submitted to the
repository, on be half of the review requester. I found this theoretically
possible (e.g. store the diff in database first), but may lead to some
complexities (e.g. changes may finally arrive the repository in a different
order of their requests).

What's worse, pending submission may even be conflicting. For example
1. user A submits file X, waiting for review
2. user B submits file X, waiting for review.
Even though A's X and B's X are conflicting, step 2 will not get any error
since A's X did NOT arrive the repository. svn can only detect conflicts
between the working copy and a file in the repository history, but not
ANOTHER USER'S WORKING COPY.

My question: what is the best practice (so far) that enables pre-commit
reviews? install RBtools on every client and force people to use post-review
to generate a request before submitting? I can't find a way to really force
them to do so :(

- Rujia

On Thu, Aug 20, 2009 at 6:18 PM, Christian Hammond chip...@chipx86.comwrote:

 Looks like we're not properly checking whether there's an error and
 assuming it's a draft. Certainly a bug. If you can file this backtrace in a
 bug report, that would be helpful.

 The problem is that the user specified doesn't have permission to modify
 that review request. The code that checks that is returning a
 WebAPIResponseError, but the code calling the function that received that as
 a return value isn't checking to see if it got an error response.

 Is the username and password you're using that of the user who submitted
 the code, or is it a special user with the special permissions? See
 http://review-board.org/docs/manual/dev/users/tools/post-review/#automatingpost-review

 Christian

 --
 Christian Hammond - chip...@chipx86.com
 Review Board - http://www.review-board.org
 VMware, Inc. - http://www.vmware.com



--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
reviewboard group.
To post to this group, send email to reviewboard@googlegroups.com
To unsubscribe from this group, send email to 
reviewboard+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/reviewboard?hl=en
-~--~~~~--~~--~--~---