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

Unified Diff: tools/submit_try

Issue 12726006: Use "svn cat" in tools/submit_try (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Created 7 years, 9 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 | « no previous file | tools/svn.py » ('j') | tools/svn.py » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/submit_try
===================================================================
--- tools/submit_try (revision 8147)
+++ tools/submit_try (working copy)
@@ -13,27 +13,19 @@
"""
-from contextlib import closing
-
import httplib
import json
import os
import subprocess
+import svn
import sys
-import urllib2
-def GetGlobalVariables():
- """ Retrieve a global variable from the global_variables.json file. """
- global_variables_file = ('http://skia.googlecode.com/svn/buildbot/'
- 'site_config/global_variables.json')
- with closing(urllib2.urlopen(global_variables_file)) as f:
- return json.load(f)
+GLOBAL_VARIABLES = json.loads(svn.Svn.Cat('http://skia.googlecode.com/svn/'
+ 'buildbot/site_config/'
+ 'global_variables.json'))
-GLOBAL_VARIABLES = GetGlobalVariables()
-
-
def GetGlobalVariable(var_name):
return GLOBAL_VARIABLES[var_name]['value']
@@ -56,8 +48,8 @@
TRYSERVER_SVN_URL = 'TRYSERVER_SVN_URL: '
# Strings used for matching svn config properties.
-URL_STR = 'URL: '
-REPO_ROOT_STR = 'Repository Root: '
+URL_STR = 'URL'
+REPO_ROOT_STR = 'Repository Root'
def FindDepotTools():
@@ -79,20 +71,10 @@
a git checkout.
"""
if is_svn:
- svn_cmd = 'svn.bat' if os.name == 'nt' else 'svn'
- cmd = [svn_cmd, 'info']
- proc = subprocess.Popen(cmd, stdout=subprocess.PIPE,
- stderr=subprocess.STDOUT)
- if proc.wait() != 0:
- raise Exception('Couldn\'t find checkout root!')
- output = proc.communicate()[0].split('\n')
- url = None
- repo_root = None
- for line in output:
- if line.startswith(REPO_ROOT_STR):
- repo_root = line[len(REPO_ROOT_STR):].rstrip()
- elif line.startswith(URL_STR):
- url = line[len(URL_STR):].rstrip()
+ repo = svn.Svn(os.curdir)
+ svn_info = repo.GetInfo()
+ url = svn_info.get(URL_STR, None)
+ repo_root = svn_info.get(REPO_ROOT_STR, None)
if not url or not repo_root:
raise Exception('Couldn\'t find checkout root!')
if url == repo_root:
« no previous file with comments | « no previous file | tools/svn.py » ('j') | tools/svn.py » ('J')

Powered by Google App Engine
This is Rietveld 408576698