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

Side by Side Diff: gcl.py

Issue 1619005: Allow the existence of ~/.gcl_upload_no_try override the default of try on up... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools/
Patch Set: '' Created 10 years, 8 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 | tests/gcl_unittest.py » ('j') | 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/python 1 #!/usr/bin/python
2 # Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. 2 # Copyright (c) 2006-2009 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 """Wrapper script around Rietveld's upload.py that groups files into 6 """Wrapper script around Rietveld's upload.py that groups files into
7 changelists.""" 7 changelists."""
8 8
9 import getpass 9 import getpass
10 import os 10 import os
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 51
52 # Filename where we store repository specific information for gcl. 52 # Filename where we store repository specific information for gcl.
53 CODEREVIEW_SETTINGS_FILE = "codereview.settings" 53 CODEREVIEW_SETTINGS_FILE = "codereview.settings"
54 54
55 # Warning message when the change appears to be missing tests. 55 # Warning message when the change appears to be missing tests.
56 MISSING_TEST_MSG = "Change contains new or modified methods, but no new tests!" 56 MISSING_TEST_MSG = "Change contains new or modified methods, but no new tests!"
57 57
58 # Global cache of files cached in GetCacheDir(). 58 # Global cache of files cached in GetCacheDir().
59 FILES_CACHE = {} 59 FILES_CACHE = {}
60 60
61 def CheckHomeForFile(filename):
62 """Checks the users home dir for the existence of the given file. Returns
63 the path to the file if it's there, or None if it is not.
64 """
65 home_vars = ['HOME']
66 if sys.platform in ('cygwin', 'win32'):
67 home_vars.append('USERPROFILE')
68 for home_var in home_vars:
69 home = os.getenv(home_var)
70 if home != None:
71 full_path = os.path.join(home, filename)
72 if os.path.exists(full_path):
73 return full_path
74 return None
61 75
62 def UnknownFiles(extra_args): 76 def UnknownFiles(extra_args):
63 """Runs svn status and returns unknown files. 77 """Runs svn status and returns unknown files.
64 78
65 Any args in |extra_args| are passed to the tool to support giving alternate 79 Any args in |extra_args| are passed to the tool to support giving alternate
66 code locations. 80 code locations.
67 """ 81 """
68 return [item[1] for item in SVN.CaptureStatus(extra_args) 82 return [item[1] for item in SVN.CaptureStatus(extra_args)
69 if item[0][0] == '?'] 83 if item[0][0] == '?']
70 84
(...skipping 546 matching lines...) Expand 10 before | Expand all | Expand 10 after
617 Basic commands: 631 Basic commands:
618 ----------------------------------------- 632 -----------------------------------------
619 gcl change change_name 633 gcl change change_name
620 Add/remove files to a changelist. Only scans the current directory and 634 Add/remove files to a changelist. Only scans the current directory and
621 subdirectories. 635 subdirectories.
622 636
623 gcl upload change_name [-r reviewer1@gmail.com,reviewer2@gmail.com,...] 637 gcl upload change_name [-r reviewer1@gmail.com,reviewer2@gmail.com,...]
624 [--send_mail] [--no_try] [--no_presubmit] 638 [--send_mail] [--no_try] [--no_presubmit]
625 [--no_watchlists] 639 [--no_watchlists]
626 Uploads the changelist to the server for review. 640 Uploads the changelist to the server for review.
641 (You can create the file '.gcl_upload_no_try' in your home dir to
642 skip the automatic tries.)
627 643
628 gcl commit change_name [--no_presubmit] 644 gcl commit change_name [--no_presubmit]
629 Commits the changelist to the repository. 645 Commits the changelist to the repository.
630 646
631 gcl lint change_name 647 gcl lint change_name
632 Check all the files in the changelist for possible style violations. 648 Check all the files in the changelist for possible style violations.
633 649
634 Advanced commands: 650 Advanced commands:
635 ----------------------------------------- 651 -----------------------------------------
636 gcl delete change_name 652 gcl delete change_name
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
699 return True 715 return True
700 return DoPresubmitChecks(change_info, committing, True) 716 return DoPresubmitChecks(change_info, committing, True)
701 717
702 718
703 def UploadCL(change_info, args): 719 def UploadCL(change_info, args):
704 if not change_info.GetFiles(): 720 if not change_info.GetFiles():
705 print "Nothing to upload, changelist is empty." 721 print "Nothing to upload, changelist is empty."
706 return 722 return
707 if not OptionallyDoPresubmitChecks(change_info, False, args): 723 if not OptionallyDoPresubmitChecks(change_info, False, args):
708 return 724 return
709 no_try = FilterFlag(args, "--no_try") or FilterFlag(args, "--no-try") 725 no_try = FilterFlag(args, "--no_try") or \
726 FilterFlag(args, "--no-try") or \
727 not (CheckHomeForFile(".gcl_upload_no_try") is None)
710 no_watchlists = FilterFlag(args, "--no_watchlists") or \ 728 no_watchlists = FilterFlag(args, "--no_watchlists") or \
711 FilterFlag(args, "--no-watchlists") 729 FilterFlag(args, "--no-watchlists")
712 730
713 # Map --send-mail to --send_mail 731 # Map --send-mail to --send_mail
714 if FilterFlag(args, "--send-mail"): 732 if FilterFlag(args, "--send-mail"):
715 args.append("--send_mail") 733 args.append("--send_mail")
716 734
717 # Supports --clobber for the try server. 735 # Supports --clobber for the try server.
718 clobber = FilterFlag(args, "--clobber") 736 clobber = FilterFlag(args, "--clobber")
719 737
(...skipping 488 matching lines...) Expand 10 before | Expand all | Expand 10 after
1208 return 0 1226 return 0
1209 args =["svn", command] 1227 args =["svn", command]
1210 root = GetRepositoryRoot() 1228 root = GetRepositoryRoot()
1211 args.extend([os.path.join(root, x) for x in change_info.GetFileNames()]) 1229 args.extend([os.path.join(root, x) for x in change_info.GetFileNames()])
1212 RunShell(args, True) 1230 RunShell(args, True)
1213 return 0 1231 return 0
1214 1232
1215 1233
1216 if __name__ == "__main__": 1234 if __name__ == "__main__":
1217 sys.exit(main()) 1235 sys.exit(main())
OLDNEW
« no previous file with comments | « no previous file | tests/gcl_unittest.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698