| OLD | NEW |
| 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 # Copyright (C) 2008 Evan Martin <martine@danga.com> | 6 # Copyright (C) 2008 Evan Martin <martine@danga.com> |
| 7 | 7 |
| 8 """A git-command for integrating reviews on Rietveld.""" | 8 """A git-command for integrating reviews on Rietveld.""" |
| 9 | 9 |
| 10 import logging | 10 import logging |
| (...skipping 1369 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1380 command = '<command>' | 1380 command = '<command>' |
| 1381 else: | 1381 else: |
| 1382 # OptParser.description prefer nicely non-formatted strings. | 1382 # OptParser.description prefer nicely non-formatted strings. |
| 1383 parser.description = re.sub('[\r\n ]{2,}', ' ', obj.__doc__) | 1383 parser.description = re.sub('[\r\n ]{2,}', ' ', obj.__doc__) |
| 1384 parser.set_usage('usage: %%prog %s [options] %s' % (command, more)) | 1384 parser.set_usage('usage: %%prog %s [options] %s' % (command, more)) |
| 1385 | 1385 |
| 1386 | 1386 |
| 1387 def main(argv): | 1387 def main(argv): |
| 1388 """Doesn't parse the arguments here, just find the right subcommand to | 1388 """Doesn't parse the arguments here, just find the right subcommand to |
| 1389 execute.""" | 1389 execute.""" |
| 1390 if sys.hexversion < 0x02060000: |
| 1391 print >> sys.stderr, ( |
| 1392 '\nYour python version %s is unsupported, please upgrade.\n' % |
| 1393 sys.version.split(' ', 1)[0]) |
| 1394 return 2 |
| 1390 # Reload settings. | 1395 # Reload settings. |
| 1391 global settings | 1396 global settings |
| 1392 settings = Settings() | 1397 settings = Settings() |
| 1393 | 1398 |
| 1394 # Do it late so all commands are listed. | 1399 # Do it late so all commands are listed. |
| 1395 CMDhelp.usage_more = ('\n\nCommands are:\n' + '\n'.join([ | 1400 CMDhelp.usage_more = ('\n\nCommands are:\n' + '\n'.join([ |
| 1396 ' %-10s %s' % (fn[3:], Command(fn[3:]).__doc__.split('\n')[0].strip()) | 1401 ' %-10s %s' % (fn[3:], Command(fn[3:]).__doc__.split('\n')[0].strip()) |
| 1397 for fn in dir(sys.modules[__name__]) if fn.startswith('CMD')])) | 1402 for fn in dir(sys.modules[__name__]) if fn.startswith('CMD')])) |
| 1398 | 1403 |
| 1399 # Create the option parse and add --verbose support. | 1404 # Create the option parse and add --verbose support. |
| (...skipping 28 matching lines...) Expand all Loading... |
| 1428 'and retry or visit go/isgaeup.\n%s') % (e.code, str(e))) | 1433 'and retry or visit go/isgaeup.\n%s') % (e.code, str(e))) |
| 1429 | 1434 |
| 1430 # Not a known command. Default to help. | 1435 # Not a known command. Default to help. |
| 1431 GenUsage(parser, 'help') | 1436 GenUsage(parser, 'help') |
| 1432 return CMDhelp(parser, argv) | 1437 return CMDhelp(parser, argv) |
| 1433 | 1438 |
| 1434 | 1439 |
| 1435 if __name__ == '__main__': | 1440 if __name__ == '__main__': |
| 1436 fix_encoding.fix_encoding() | 1441 fix_encoding.fix_encoding() |
| 1437 sys.exit(main(sys.argv[1:])) | 1442 sys.exit(main(sys.argv[1:])) |
| OLD | NEW |