Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(66)

Unified Diff: git_cl.py

Issue 6825008: First stab at using Rietveld wrapper object in both gcl.py and git-cl. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools
Patch Set: small fix Created 9 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « gcl.py ('k') | presubmit_support.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: git_cl.py
diff --git a/git_cl.py b/git_cl.py
index ba31e189e0fef1a1fd10d9bd3db342eaa66bb5d7..8cdf1318c5d27e2350aabccd6f1c8dcf81c2d461 100755
--- a/git_cl.py
+++ b/git_cl.py
@@ -39,6 +39,7 @@ from third_party import upload
import breakpad # pylint: disable=W0611
import fix_encoding
import presubmit_support
+import rietveld
import scm
import watchlists
@@ -463,7 +464,7 @@ or verify this branch is set up to track another (via the --track argument to
if not self.has_description:
if self.GetIssue():
path = '/' + self.GetIssue() + '/description'
- rpc_server = self._RpcServer()
+ rpc_server = self.RpcServer()
self.description = rpc_server.Send(path).strip()
self.has_description = True
if pretty:
@@ -494,9 +495,9 @@ or verify this branch is set up to track another (via the --track argument to
def GetPatchSetDiff(self, issue):
# Grab the last patchset of the issue first.
- data = json.loads(self._RpcServer().Send('/api/%s' % issue))
+ data = json.loads(self.RpcServer().Send('/api/%s' % issue))
patchset = data['patchsets'][-1]
- return self._RpcServer().Send(
+ return self.RpcServer().Send(
'/download/issue%s_%s.diff' % (issue, patchset))
def SetIssue(self, issue):
@@ -511,7 +512,7 @@ or verify this branch is set up to track another (via the --track argument to
self.has_issue = False
def CloseIssue(self):
- rpc_server = self._RpcServer()
+ rpc_server = self.RpcServer()
# Newer versions of Rietveld require us to pass an XSRF token to POST, so
# we fetch it from the server. (The version used by Chromium has been
# modified so the token isn't required when closing an issue.)
@@ -523,14 +524,15 @@ or verify this branch is set up to track another (via the --track argument to
data = [("description", self.description),
("xsrf_token", xsrf_token)]
ctype, body = upload.EncodeMultipartFormData(data, [])
- rpc_server.Send('/' + self.GetIssue() + '/close', body, ctype)
+ rpc_server.Send(
+ '/' + self.GetIssue() + '/close', payload=body, content_type=ctype)
- def _RpcServer(self):
+ def RpcServer(self):
"""Returns an upload.RpcServer() to access this review's rietveld instance.
"""
if not self._rpc_server:
- server = self.GetRietveldServer()
- self._rpc_server = upload.GetRpcServer(server, save_cookies=True)
+ self.GetIssue()
+ self._rpc_server = rietveld.Rietveld(self.rietveld_server, None, None)
return self._rpc_server
def _IssueSetting(self):
@@ -848,7 +850,7 @@ def RunHook(committing, upstream_branch, rietveld_server, tbr, may_prompt,
output = presubmit_support.DoPresubmitChecks(change, committing,
verbose=verbose, output_stream=sys.stdout, input_stream=sys.stdin,
default_presubmit=None, may_prompt=may_prompt, tbr=tbr,
- host_url=cl.GetRietveldServer())
+ rietveld=cl.RpcServer())
except presubmit_support.PresubmitFailure, e:
DieWithError(
('%s\nMaybe your depot_tools is out of date?\n'
« no previous file with comments | « gcl.py ('k') | presubmit_support.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698