Chromium Code Reviews| 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 |