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 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
171 FILES_CACHE[filename] = content | 171 FILES_CACHE[filename] = content |
172 return FILES_CACHE[filename] | 172 return FILES_CACHE[filename] |
173 | 173 |
174 | 174 |
175 def GetCodeReviewSetting(key): | 175 def GetCodeReviewSetting(key): |
176 """Returns a value for the given key for this repository.""" | 176 """Returns a value for the given key for this repository.""" |
177 # Use '__just_initialized' as a flag to determine if the settings were | 177 # Use '__just_initialized' as a flag to determine if the settings were |
178 # already initialized. | 178 # already initialized. |
179 global CODEREVIEW_SETTINGS | 179 global CODEREVIEW_SETTINGS |
180 if '__just_initialized' not in CODEREVIEW_SETTINGS: | 180 if '__just_initialized' not in CODEREVIEW_SETTINGS: |
181 for line in GetCachedFile(CODEREVIEW_SETTINGS_FILE).splitlines(): | 181 settings_file = GetCachedFile(CODEREVIEW_SETTINGS_FILE) |
182 if not line or line.startswith("#"): | 182 if settings_file: |
183 continue | 183 for line in settings_file.splitlines(): |
184 k, v = line.split(": ", 1) | 184 if not line or line.startswith("#"): |
185 CODEREVIEW_SETTINGS[k] = v | 185 continue |
| 186 k, v = line.split(": ", 1) |
| 187 CODEREVIEW_SETTINGS[k] = v |
186 CODEREVIEW_SETTINGS.setdefault('__just_initialized', None) | 188 CODEREVIEW_SETTINGS.setdefault('__just_initialized', None) |
187 return CODEREVIEW_SETTINGS.get(key, "") | 189 return CODEREVIEW_SETTINGS.get(key, "") |
188 | 190 |
189 | 191 |
190 def Warn(msg): | 192 def Warn(msg): |
191 ErrorExit(msg, exit=False) | 193 ErrorExit(msg, exit=False) |
192 | 194 |
193 | 195 |
194 def ErrorExit(msg, exit=True): | 196 def ErrorExit(msg, exit=True): |
195 """Print an error message to stderr and optionally exit.""" | 197 """Print an error message to stderr and optionally exit.""" |
(...skipping 936 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1132 # the files. This allows commands such as 'gcl diff xxx' to work. | 1134 # the files. This allows commands such as 'gcl diff xxx' to work. |
1133 args =["svn", command] | 1135 args =["svn", command] |
1134 root = GetRepositoryRoot() | 1136 root = GetRepositoryRoot() |
1135 args.extend([os.path.join(root, x) for x in change_info.FileList()]) | 1137 args.extend([os.path.join(root, x) for x in change_info.FileList()]) |
1136 RunShell(args, True) | 1138 RunShell(args, True) |
1137 return 0 | 1139 return 0 |
1138 | 1140 |
1139 | 1141 |
1140 if __name__ == "__main__": | 1142 if __name__ == "__main__": |
1141 sys.exit(main()) | 1143 sys.exit(main()) |
OLD | NEW |