HOWTO control Rietveld patch generation: Difference between revisions
(fix typo) |
No edit summary |
||
Line 1: | Line 1: | ||
{{TOC}} | {{TOC}} | ||
== Authentication flow == | |||
As of mid-2015, Google changed authentication, and users need to pass either '--oauth2' or '--no_oauth2_webbrowser' options for upload.py., e.g. | |||
python ../upload.py --oauth2 --issue=293380043 --rev=12096 | |||
If you use the '--oauth2' option for browser-based authentication, you may see this kind of response, in which case you must visit the page requested and sign in to complete the upload: | |||
Your browser has been opened to visit: | |||
https://codereview.appspot.com/get-access-token?port=8001 | |||
If your browser is on a different machine then exit and re-run | |||
upload.py with the command-line parameter | |||
--no_oauth2_webbrowser | |||
== Password authentication errors == | == Password authentication errors == |
Latest revision as of 16:44, 4 July 2016
Main Page - Roadmap - Summer Projects - Project Ideas - Developer FAQ - Tools - Related Projects
HOWTOs - Installation - Troubleshooting - User FAQ - Samples - Models - Education - Contributed Code - Papers
Authentication flow
As of mid-2015, Google changed authentication, and users need to pass either '--oauth2' or '--no_oauth2_webbrowser' options for upload.py., e.g.
python ../upload.py --oauth2 --issue=293380043 --rev=12096
If you use the '--oauth2' option for browser-based authentication, you may see this kind of response, in which case you must visit the page requested and sign in to complete the upload:
Your browser has been opened to visit: https://codereview.appspot.com/get-access-token?port=8001 If your browser is on a different machine then exit and re-run upload.py with the command-line parameter --no_oauth2_webbrowser
Password authentication errors
If you get this kind of error message when using upload.py:
Traceback (most recent call last): File "upload.py", line 2719, in <module> main() File "upload.py", line 2711, in main RealMain(sys.argv) File "upload.py", line 2667, in RealMain response_body = rpc_server.Send("/upload", body, content_type=ctype) File "upload.py", line 474, in Send self._Authenticate() File "upload.py", line 501, in _Authenticate super(HttpRpcServer, self)._Authenticate() File "upload.py", line 381, in _Authenticate auth_token = self._GetAuthToken(credentials[0], credentials[1]) File "upload.py", line 335, in _GetAuthToken e.headers, response_dict) __main__.ClientLoginError: HTTP Error 403: Forbidden
or this
File "./upload.py", line 2721, in <module> main() File "./upload.py", line 2713, in main RealMain(sys.argv) File "./upload.py", line 2669, in RealMain response_body = rpc_server.Send("/upload", body, content_type=ctype) File "./upload.py", line 447, in Send self._Authenticate() File "./upload.py", line 502, in _Authenticate super(HttpRpcServer, self)._Authenticate() File "./upload.py", line 382, in _Authenticate auth_token = self._GetAuthToken(credentials[0], credentials[1]) File "./upload.py", line 326, in _GetAuthToken response = self.opener.open(req) File "/usr/lib/python2.7/urllib2.py", line 437, in open response = meth(req, response) File "/usr/lib/python2.7/urllib2.py", line 550, in http_response 'http', request, response, code, msg, hdrs) File "/usr/lib/python2.7/urllib2.py", line 475, in error return self._call_chain(*args) File "/usr/lib/python2.7/urllib2.py", line 409, in _call_chain result = func(*args) File "/usr/lib/python2.7/urllib2.py", line 558, in http_error_default raise HTTPError(req.get_full_url(), code, msg, hdrs, fp)
urllib2.HTTPError: HTTP Error 404: Not Found
You may need to pass the '--oauth2' flag to upload.py and use browser-based authentication (due to Google authentication changes around mid-2015). You also may try --no_oauth2_webbrowser
Updating an existing code issue with an additional patch
Assume that you initiated a code review and you would like to address comments from reviewers and update your code. You would like your new codereview patchset to be the union of the first and the second.
The first one was most likely uploaded by specifying the initial base changeset; e.g., if the base code is in revision 8954, and your patch for review in 8955, it would be like:
$ python upload.py --rev=8954 --cc=ns-3-reviews@googlegroups.com Upload server: codereview.appspot.com (change with -s/--server) Loaded authentication cookies from /home/tomh/.codereview_upload_cookies New issue subject: replace src/mobility usage of RandomVariable with RandomVariableStream" Issue created. URL: http://codereview.appspot.com/6443113 Uploading base file for src/mobility/model/gauss-markov-mobility-model.h Uploading base file for src/mobility/model/random-direction-2d-mobility-model.h Uploading base file for src/wimax/examples/wimax-multicast.cc
Let's assume that you fixed some things in revision 8956. The second upload needs to reference the original issue (6443113 in this example) and also to specify the original revision number (8954 in this example):
$ python upload.py --rev=8954 --issue=6443113
Display different changesets as different patchsets
Assume that you have a repository with two changesets that you want reviewed as separate patchsets (i.e. you want Rietveld to preserve the changesets and not merge them into a single patch). See this code issue as an example: http://codereview.appspot.com/6443113
Assume that 8954 is the base, 8954:8955 is the first changeset, and 8955:8956 is the second changeset.
changeset: 8956:208d6b79fa5d tag: tip user: Tom Henderson <tomh@tomh.org> date: Fri Aug 10 14:37:46 2012 -0700 summary: Add AssignStreams support to mobility code changeset: 8955:38db106173a9 user: Tom Henderson <tomh@tomh.org> date: Thu Aug 09 10:53:04 2012 -0700 summary: port mobility-related code to RandomVariableStream changeset: 8954:505e3a5b7c80 user: Tom Henderson <tomh@tomh.org> date: Wed Aug 01 13:19:33 2012 -0700 summary: bug 1386: assert if PositionAllocator not provided to RandomWaypointMobilityModel
The first one is uploaded by specifying the revisions explicitly:
$ python upload.py --rev=8954:8955 Upload server: codereview.appspot.com (change with -s/--server) Loaded authentication cookies from /home/tomh/.codereview_upload_cookies New issue subject: replace src/mobility usage of RandomVariable with RandomVariableStream" Issue created. URL: http://codereview.appspot.com/6443113 Uploading base file for src/mobility/model/gauss-markov-mobility-model.h Uploading base file for src/mobility/model/random-direction-2d-mobility-model.h Uploading base file for src/wimax/examples/wimax-multicast.cc ...
For your second upload, specify the second revision, and identify the previous issue:
$ python upload.py --rev=8955:8956 --issue=6443113 Upload server: codereview.appspot.com (change with -s/--server) Loaded authentication cookies from /home/tomh/.codereview_upload_cookies Title describing this patch set: add AssignStreams Issue updated. URL: http://codereview.appspot.com/6443113 Uploading base file for examples/routing/manet-routing-compare.cc Uploading base file for src/buildings/helper/building-position-allocator.cc Uploading base file for src/buildings/helper/building-position-allocator.h ...
Note that this is unlike the previous example in this HOWTO where we wanted 8954:8956 to be included.
Git example
you can do ./upload.py [options] -- [diff options] the [diff options] part will be forwarded to git diff; hence you can launch for instance: ./upload.py --oauth2 -- master..HEAD