| OLD | NEW |
| 1 #!/usr/bin/python | 1 #!/usr/bin/python |
| 2 | 2 |
| 3 # Copyright (c) 2010 The Chromium OS Authors. All rights reserved. | 3 # Copyright (c) 2010 The Chromium OS Authors. All rights reserved. |
| 4 # Use of this source code is governed by a BSD-style license that can be | 4 # Use of this source code is governed by a BSD-style license that can be |
| 5 # found in the LICENSE file. | 5 # found in the LICENSE file. |
| 6 | 6 |
| 7 """This module uprevs a given package's ebuild to the next revision.""" | 7 """This module uprevs a given package's ebuild to the next revision.""" |
| 8 | 8 |
| 9 | 9 |
| 10 import fileinput | 10 import fileinput |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 116 | 116 |
| 117 def _PrintUsageAndDie(error_message=''): | 117 def _PrintUsageAndDie(error_message=''): |
| 118 """Prints optional error_message the usage and returns an error exit code.""" | 118 """Prints optional error_message the usage and returns an error exit code.""" |
| 119 command_usage = 'Commands: \n' | 119 command_usage = 'Commands: \n' |
| 120 # Add keys and usage information from dictionary. | 120 # Add keys and usage information from dictionary. |
| 121 commands = sorted(_COMMAND_DICTIONARY.keys()) | 121 commands = sorted(_COMMAND_DICTIONARY.keys()) |
| 122 for command in commands: | 122 for command in commands: |
| 123 command_usage += ' %s: %s\n' % (command, _COMMAND_DICTIONARY[command]) | 123 command_usage += ' %s: %s\n' % (command, _COMMAND_DICTIONARY[command]) |
| 124 commands_str = '|'.join(commands) | 124 commands_str = '|'.join(commands) |
| 125 Warning('Usage: %s FLAGS [%s]\n\n%s\nFlags:%s' % (sys.argv[0], commands_str, | 125 Warning('Usage: %s FLAGS [%s]\n\n%s\nFlags:%s' % (sys.argv[0], commands_str, |
| 126 command_usage, gflags.FLAGS)) | 126 command_usage, |
| 127 gflags.FLAGS)) |
| 127 if error_message: | 128 if error_message: |
| 128 Die(error_message) | 129 Die(error_message) |
| 129 else: | 130 else: |
| 130 sys.exit(1) | 131 sys.exit(1) |
| 131 | 132 |
| 132 def _PushChange(): | 133 def _PushChange(): |
| 133 """Pushes changes to the git repository. | 134 """Pushes changes to the git repository. |
| 134 | 135 |
| 135 Pushes locals commits from calls to CommitChange to the remote git | 136 Pushes locals commits from calls to CommitChange to the remote git |
| 136 repository specified by os.pwd. | 137 repository specified by os.pwd. |
| (...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 388 except (OSError, IOError): | 389 except (OSError, IOError): |
| 389 Warning('Cannot rev %s\n' % ebuild.package, | 390 Warning('Cannot rev %s\n' % ebuild.package, |
| 390 'Note you will have to go into %s ' | 391 'Note you will have to go into %s ' |
| 391 'and reset the git repo yourself.' % overlay) | 392 'and reset the git repo yourself.' % overlay) |
| 392 raise | 393 raise |
| 393 | 394 |
| 394 | 395 |
| 395 if __name__ == '__main__': | 396 if __name__ == '__main__': |
| 396 main(sys.argv) | 397 main(sys.argv) |
| 397 | 398 |
| OLD | NEW |