Modify submit_try to work on windows

Review URL: https://codereview.appspot.com/7199053

git-svn-id: http://skia.googlecode.com/svn/trunk@7379 2bbb7eff-a529-9590-31e7-b0007b416f81
This commit is contained in:
borenet@google.com 2013-01-24 21:38:51 +00:00
parent 4bbdeac58c
commit 6c55b513bf
2 changed files with 16 additions and 8 deletions

View File

@ -52,7 +52,7 @@ def FindDepotTools():
proc = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
if proc.wait() != 0:
raise Exception('Couldn\'t find depot_tools in PATH!')
gcl = proc.communicate()[0]
gcl = proc.communicate()[0].split('\n')[0].rstrip()
depot_tools_dir = os.path.dirname(gcl)
return depot_tools_dir
@ -64,7 +64,8 @@ def GetCheckoutRoot(is_svn=True):
a git checkout.
"""
if is_svn:
cmd = ['svn', 'info']
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:
@ -165,18 +166,24 @@ def SubmitTryRequest(args, is_svn=True):
- revision: optional, int; the revision number from which to run the try.
is_svn: boolean; are we in an SVN repo?
"""
# First, find depot_tools. This is needed for the imports below.
sys.path.append(FindDepotTools())
botlist = ','.join(['%s%s' % (bot, TRYBOT_SUFFIX) for bot in args.bot])
if is_svn:
import gcl
try_args = [args.changelist, '--root', GetCheckoutRoot(is_svn),
gcl_cmd = 'gcl.bat' if os.name == 'nt' else 'gcl'
try_args = [gcl_cmd, 'try', args.changelist,
'--root', GetCheckoutRoot(is_svn),
'--bot', botlist]
if args.revision:
try_args.extend(['-r', args.revision])
gcl.CMDtry(try_args)
print ' '.join(try_args)
proc = subprocess.Popen(try_args, stdout=subprocess.PIPE,
stderr=subprocess.STDOUT)
if proc.wait() != 0:
raise Exception('Failed to submit try request: %s' % (
proc.communicate()[0]))
print proc.communicate()[0]
else:
# First, find depot_tools. This is needed to import trychange.
sys.path.append(FindDepotTools())
import trychange
try_args = ['--use_svn',
'--svn_repo', GetTryRepo(),

1
tools/submit_try.bat Normal file
View File

@ -0,0 +1 @@
python tools\submit_try %*