Add support to commit tryjob to a test branch.

This is for testing a tryserver master locally vs. in production.

BUG=chromium-os:20860
TEST=Verified tryjob committing properly, with local patching (to test
     patch.py changes).  Unittests.

Change-Id: I45b6be6b4eced52105e90664601f6a0e00dc06e1
Reviewed-on: https://gerrit.chromium.org/gerrit/17111
Commit-Ready: Ryan Cui <rcui@chromium.org>
Tested-by: Ryan Cui <rcui@chromium.org>
Reviewed-by: David James <davidjames@chromium.org>
diff --git a/scripts/cbuildbot.py b/scripts/cbuildbot.py
index d46da91..ad74ce6 100644
--- a/scripts/cbuildbot.py
+++ b/scripts/cbuildbot.py
@@ -763,6 +763,10 @@
                     help="Specify the maximum amount of time this job can run "
                          "for, at which point the build will be aborted.  If "
                          "set to zero, then there is no timeout")
+  group.add_option('--test-tryjob', action='store_true',
+                   default=False,
+                   help='Submit a tryjob to the test repository.  Will not '
+                        'show up on the production trybot waterfall.')
   group.add_option('--validation_pool', default=None,
                    help='Path to a pickled validation pool. Intended for use '
                    'only with the commit queue.')
@@ -908,7 +912,7 @@
                                           options.local_patches)
     print 'Submitting tryjob...'
     tryjob = remote_try.RemoteTryJob(options, args, local_patches)
-    tryjob.Submit(dryrun=options.debug)
+    tryjob.Submit(testjob=options.test_tryjob, dryrun=options.debug)
     print 'Tryjob submitted!'
     print ('Go to %s to view the status of your job.'
            % tryjob.GetTrybotWaterfallLink())