| OLD | NEW |
| 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 982 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 993 | 993 |
| 994 def Change(change_info, args): | 994 def Change(change_info, args): |
| 995 """Creates/edits a changelist.""" | 995 """Creates/edits a changelist.""" |
| 996 silent = FilterFlag(args, "--silent") | 996 silent = FilterFlag(args, "--silent") |
| 997 | 997 |
| 998 # Verify the user is running the change command from a read-write checkout. | 998 # Verify the user is running the change command from a read-write checkout. |
| 999 svn_info = gclient_scm.CaptureSVNInfo('.') | 999 svn_info = gclient_scm.CaptureSVNInfo('.') |
| 1000 if not svn_info: | 1000 if not svn_info: |
| 1001 ErrorExit("Current checkout is unversioned. Please retry with a versioned " | 1001 ErrorExit("Current checkout is unversioned. Please retry with a versioned " |
| 1002 "directory.") | 1002 "directory.") |
| 1003 if (svn_info.get('URL', '').startswith('http:') and | |
| 1004 not FilterFlag(args, "--force")): | |
| 1005 ErrorExit("This is a read-only checkout. Retry in a read-write checkout " | |
| 1006 "or use --force to override.") | |
| 1007 | 1003 |
| 1008 if (len(args) == 1): | 1004 if (len(args) == 1): |
| 1009 filename = args[0] | 1005 filename = args[0] |
| 1010 f = open(filename, 'rU') | 1006 f = open(filename, 'rU') |
| 1011 override_description = f.read() | 1007 override_description = f.read() |
| 1012 f.close() | 1008 f.close() |
| 1013 else: | 1009 else: |
| 1014 override_description = None | 1010 override_description = None |
| 1015 | 1011 |
| 1016 if change_info.issue: | 1012 if change_info.issue: |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1086 break | 1082 break |
| 1087 status = line[:7] | 1083 status = line[:7] |
| 1088 filename = line[7:] | 1084 filename = line[7:] |
| 1089 new_cl_files.append((status, filename)) | 1085 new_cl_files.append((status, filename)) |
| 1090 | 1086 |
| 1091 if (not len(change_info._files)) and (not change_info.issue) and \ | 1087 if (not len(change_info._files)) and (not change_info.issue) and \ |
| 1092 (not len(new_description) and (not new_cl_files)): | 1088 (not len(new_description) and (not new_cl_files)): |
| 1093 ErrorExit("Empty changelist not saved") | 1089 ErrorExit("Empty changelist not saved") |
| 1094 | 1090 |
| 1095 change_info._files = new_cl_files | 1091 change_info._files = new_cl_files |
| 1092 change_info.Save() |
| 1093 if svn_info.get('URL', '').startswith('http:'): |
| 1094 Warn("WARNING: Creating CL in a read-only checkout. You will not be " |
| 1095 "able to commit it!") |
| 1096 | 1096 |
| 1097 change_info.Save() | |
| 1098 print change_info.name + " changelist saved." | 1097 print change_info.name + " changelist saved." |
| 1099 if change_info.MissingTests(): | 1098 if change_info.MissingTests(): |
| 1100 Warn("WARNING: " + MISSING_TEST_MSG) | 1099 Warn("WARNING: " + MISSING_TEST_MSG) |
| 1101 | 1100 |
| 1102 # Valid extensions for files we want to lint. | 1101 # Valid extensions for files we want to lint. |
| 1103 DEFAULT_LINT_REGEX = r"(.*\.cpp|.*\.cc|.*\.h)" | 1102 DEFAULT_LINT_REGEX = r"(.*\.cpp|.*\.cc|.*\.h)" |
| 1104 DEFAULT_LINT_IGNORE_REGEX = r"" | 1103 DEFAULT_LINT_IGNORE_REGEX = r"" |
| 1105 | 1104 |
| 1106 def Lint(change_info, args): | 1105 def Lint(change_info, args): |
| 1107 """Runs cpplint.py on all the files in |change_info|""" | 1106 """Runs cpplint.py on all the files in |change_info|""" |
| (...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1295 return 0 | 1294 return 0 |
| 1296 args =["svn", command] | 1295 args =["svn", command] |
| 1297 root = GetRepositoryRoot() | 1296 root = GetRepositoryRoot() |
| 1298 args.extend([os.path.join(root, x) for x in change_info.GetFileNames()]) | 1297 args.extend([os.path.join(root, x) for x in change_info.GetFileNames()]) |
| 1299 RunShell(args, True) | 1298 RunShell(args, True) |
| 1300 return 0 | 1299 return 0 |
| 1301 | 1300 |
| 1302 | 1301 |
| 1303 if __name__ == "__main__": | 1302 if __name__ == "__main__": |
| 1304 sys.exit(main()) | 1303 sys.exit(main()) |
| OLD | NEW |