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

Side by Side Diff: trychange.py

Issue 275383003: Renamed Tryjob label to Tryjob-Request (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools
Patch Set: Created 6 years, 7 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 """Client-side script to send a try job to the try server. It communicates to 6 """Client-side script to send a try job to the try server. It communicates to
7 the try server by either writting to a svn/git repository or by directly 7 the try server by either writting to a svn/git repository or by directly
8 connecting to the server by HTTP. 8 connecting to the server by HTTP.
9 """ 9 """
10 10
(...skipping 704 matching lines...) Expand 10 before | Expand all | Expand 10 after
715 patch_git('reset', '--hard', 'origin/master') 715 patch_git('reset', '--hard', 'origin/master')
716 raise 716 raise
717 717
718 PrintSuccess(bot_spec, options) 718 PrintSuccess(bot_spec, options)
719 719
720 def _SendChangeGerrit(bot_spec, options): 720 def _SendChangeGerrit(bot_spec, options):
721 """Posts a try job to a Gerrit change. 721 """Posts a try job to a Gerrit change.
722 722
723 Reads Change-Id from the HEAD commit, resolves the current revision, checks 723 Reads Change-Id from the HEAD commit, resolves the current revision, checks
724 that local revision matches the uploaded one, posts a try job in form of a 724 that local revision matches the uploaded one, posts a try job in form of a
725 message, sets Tryjob label to 1. 725 message, sets Tryjob-Request label to 1.
726 726
727 Gerrit message format: starts with !tryjob, optionally followed by a tryjob 727 Gerrit message format: starts with !tryjob, optionally followed by a tryjob
728 definition in JSON format: 728 definition in JSON format:
729 buildNames: list of strings specifying build names. 729 buildNames: list of strings specifying build names.
730 """ 730 """
731 731
732 logging.info('Sending by Gerrit') 732 logging.info('Sending by Gerrit')
733 if not options.gerrit_url: 733 if not options.gerrit_url:
734 raise NoTryServerAccess('Please use --gerrit_url option to specify the ' 734 raise NoTryServerAccess('Please use --gerrit_url option to specify the '
735 'Gerrit instance url to connect to') 735 'Gerrit instance url to connect to')
(...skipping 25 matching lines...) Expand all
761 if job_def: 761 if job_def:
762 msg = '%s %s' % (msg, json.dumps(job_def, sort_keys=True)) 762 msg = '%s %s' % (msg, json.dumps(job_def, sort_keys=True))
763 return msg 763 return msg
764 764
765 def PostTryjob(message): 765 def PostTryjob(message):
766 logging.info('Posting gerrit message: %s' % message) 766 logging.info('Posting gerrit message: %s' % message)
767 if not options.dry_run: 767 if not options.dry_run:
768 # Post a message and set TryJob=1 label. 768 # Post a message and set TryJob=1 label.
769 try: 769 try:
770 gerrit_util.SetReview(gerrit_host, change_id, msg=message, 770 gerrit_util.SetReview(gerrit_host, change_id, msg=message,
771 labels={'Tryjob': 1}) 771 labels={'Tryjob-Request': 1})
772 except gerrit_util.GerritError, e: 772 except gerrit_util.GerritError, e:
773 if e.http_status == 400: 773 if e.http_status == 400:
774 raise Error(e.reason) 774 raise Error(e.reason)
775 else: 775 else:
776 raise 776 raise
777 777
778 head_sha = scm.GIT.Capture(['log', '-1', '--format=%H'], cwd=os.getcwd()) 778 head_sha = scm.GIT.Capture(['log', '-1', '--format=%H'], cwd=os.getcwd())
779 779
780 change_id = GetChangeId(head_sha) 780 change_id = GetChangeId(head_sha)
781 781
(...skipping 466 matching lines...) Expand 10 before | Expand all | Expand 10 after
1248 return 1 1248 return 1
1249 except (gclient_utils.Error, subprocess2.CalledProcessError), e: 1249 except (gclient_utils.Error, subprocess2.CalledProcessError), e:
1250 print >> sys.stderr, e 1250 print >> sys.stderr, e
1251 return 1 1251 return 1
1252 return 0 1252 return 0
1253 1253
1254 1254
1255 if __name__ == "__main__": 1255 if __name__ == "__main__":
1256 fix_encoding.fix_encoding() 1256 fix_encoding.fix_encoding()
1257 sys.exit(TryChange(None, None, False)) 1257 sys.exit(TryChange(None, None, False))
OLDNEW
« 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