| 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 """\ | 6 """\ |
| 7 Wrapper script around Rietveld's upload.py that simplifies working with groups | 7 Wrapper script around Rietveld's upload.py that simplifies working with groups |
| 8 of files. | 8 of files. |
| 9 """ | 9 """ |
| 10 | 10 |
| (...skipping 1275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1286 print sys.modules[__name__].__doc__ | 1286 print sys.modules[__name__].__doc__ |
| 1287 print 'version ' + __version__ + '\n' | 1287 print 'version ' + __version__ + '\n' |
| 1288 | 1288 |
| 1289 print('Commands are:\n' + '\n'.join([ | 1289 print('Commands are:\n' + '\n'.join([ |
| 1290 ' %-12s %s' % (fn[3:], Command(fn[3:]).__doc__.split('\n')[0].strip()) | 1290 ' %-12s %s' % (fn[3:], Command(fn[3:]).__doc__.split('\n')[0].strip()) |
| 1291 for fn in dir(sys.modules[__name__]) if fn.startswith('CMD')])) | 1291 for fn in dir(sys.modules[__name__]) if fn.startswith('CMD')])) |
| 1292 return 0 | 1292 return 0 |
| 1293 | 1293 |
| 1294 | 1294 |
| 1295 def main(argv): | 1295 def main(argv): |
| 1296 if not argv: |
| 1297 argv = ['help'] |
| 1298 command = Command(argv[0]) |
| 1299 # Help can be run from anywhere. |
| 1300 if command == CMDhelp: |
| 1301 return command(argv[1:]) |
| 1302 |
| 1296 try: | 1303 try: |
| 1297 GetRepositoryRoot() | 1304 GetRepositoryRoot() |
| 1298 except gclient_utils.Error: | 1305 except gclient_utils.Error: |
| 1299 print('To use gcl, you need to be in a subversion checkout.') | 1306 print('To use gcl, you need to be in a subversion checkout.') |
| 1300 return 1 | 1307 return 1 |
| 1301 | 1308 |
| 1302 # Create the directories where we store information about changelists if it | 1309 # Create the directories where we store information about changelists if it |
| 1303 # doesn't exist. | 1310 # doesn't exist. |
| 1304 if not os.path.exists(GetInfoDir()): | 1311 if not os.path.exists(GetInfoDir()): |
| 1305 os.mkdir(GetInfoDir()) | 1312 os.mkdir(GetInfoDir()) |
| 1306 if not os.path.exists(GetChangesDir()): | 1313 if not os.path.exists(GetChangesDir()): |
| 1307 os.mkdir(GetChangesDir()) | 1314 os.mkdir(GetChangesDir()) |
| 1308 if not os.path.exists(GetCacheDir()): | 1315 if not os.path.exists(GetCacheDir()): |
| 1309 os.mkdir(GetCacheDir()) | 1316 os.mkdir(GetCacheDir()) |
| 1310 | 1317 |
| 1311 if not argv: | |
| 1312 argv = ['help'] | |
| 1313 command = Command(argv[0]) | |
| 1314 if command: | 1318 if command: |
| 1315 return command(argv[1:]) | 1319 return command(argv[1:]) |
| 1316 # Unknown command, try to pass that to svn | 1320 # Unknown command, try to pass that to svn |
| 1317 return CMDpassthru(argv) | 1321 return CMDpassthru(argv) |
| 1318 | 1322 |
| 1319 | 1323 |
| 1320 if __name__ == "__main__": | 1324 if __name__ == "__main__": |
| 1321 sys.exit(main(sys.argv[1:])) | 1325 sys.exit(main(sys.argv[1:])) |
| OLD | NEW |