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

Unified Diff: tools/submit_try

Issue 128413004: submit_try: create the diff file using git, rather than relying on trychange.py (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Created 6 years, 11 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/submit_try
===================================================================
--- tools/submit_try (revision 12952)
+++ tools/submit_try (working copy)
@@ -17,9 +17,11 @@
import json
import os
import re
+import shutil
import subprocess
import svn
import sys
+import tempfile
import buildbot_globals
@@ -270,19 +272,36 @@
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(),
- '--root', GetCheckoutRoot(is_svn),
- '--bot', botlist,
- '--patchlevel', '0']
- if args.revision:
- try_args.extend(['-r', args.revision])
- trychange.TryChange(try_args, None, False)
+ # Create the diff file.
+ cmd = ['git.bat' if os.name == 'nt' else 'git', 'diff', 'origin/master']
+ proc = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
+ if proc.wait() != 0:
+ raise Exception('Failed to capture git diff!')
+ temp_dir = tempfile.mkdtemp()
+ try:
+ diff_file = os.path.join(temp_dir, 'patch.diff')
+ with open(diff_file, 'wb') as f:
+ f.write(proc.communicate()[0])
+
+ # Find depot_tools. This is needed to import trychange.
+ sys.path.append(FindDepotTools())
+ import trychange
+ try_args = ['--use_svn',
+ '--svn_repo', GetTryRepo(),
+ '--root', GetCheckoutRoot(is_svn),
+ '--bot', botlist,
+ '--diff', diff_file,
+ ]
+ if args.revision:
+ try_args.extend(['-r', args.revision])
+ # Submit the try request.
+ trychange.TryChange(try_args, None, False)
+ finally:
+ shutil.rmtree(temp_dir)
+
+
def main():
# Retrieve the list of active try builders from the build master.
trybots = RetrieveTrybotList(json_filename='trybots')
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698