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

Unified Diff: trychange.py

Issue 503085: Fix a typo in scm.GIT.GetBranch() and add --dry_run to trychange.py to ease testing. (Closed)
Patch Set: Created 11 years 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 | « scm.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: trychange.py
diff --git a/trychange.py b/trychange.py
index b53a4f5b67aa3554f69691038db537a558adaeef..480e1389a8827f7b6b1bb7d1727b3dcd8bef2b3f 100755
--- a/trychange.py
+++ b/trychange.py
@@ -201,6 +201,15 @@ def _SendChangeHTTP(options):
proxies = {}
else:
proxies = {'http': options.proxy, 'https': options.proxy}
+
+ if options.dry_run:
+ # Last minute fake.
+ for (k,v) in values.iteritems():
+ if k != 'patch':
+ print("%s=%s" % (k,v))
+ print values['patch']
+ return
+
try:
connection = urllib.urlopen(url, urllib.urlencode(values), proxies=proxies)
except IOError, e:
@@ -228,6 +237,12 @@ def _SendChangeSVN(options):
for (k,v) in values.iteritems():
description += "%s=%s\n" % (k,v)
+ if options.dry_run:
+ # Last minute fake.
+ print str(descriptions)
+ print diff
+ return
+
# Do an empty checkout.
temp_dir = tempfile.mkdtemp()
temp_file = tempfile.NamedTemporaryFile()
@@ -337,6 +352,8 @@ def TryChange(argv,
help="Update rietveld issue try job status")
group.add_option("--patchset", type='int',
help="Update rietveld issue try job status")
+ group.add_option("--dry_run", action='store_true',
+ help="Just prints the diff and quits")
parser.add_option_group(group)
group = optparse.OptionGroup(parser, "Try job options")
@@ -356,7 +373,8 @@ def TryChange(argv,
group.add_option("--target", help=optparse.SUPPRESS_HELP)
group.add_option("--project",
- help="Override which project to use")
+ help="Override which project to use. Projects are defined "
+ "server-side to define what default bot set to use")
# Override the list of tests to run, use multiple times to list many tests
# (or comma separated)
@@ -473,8 +491,9 @@ def TryChange(argv,
# Send the patch.
options.send_patch(options)
- print 'Patch \'%s\' sent to try server: %s' % (options.name,
- ', '.join(options.bot))
+ if not options.dry_run:
bradn 2009/12/22 18:05:54 Might be worth moving this up into the http/svn ha
+ print 'Patch \'%s\' sent to try server: %s' % (options.name,
+ ', '.join(options.bot))
except (InvalidScript, NoTryServerAccess), e:
if swallow_exception:
return 1
« no previous file with comments | « scm.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698