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, | 126 command_usage, gflags.FLAGS)) |
127 gflags.FLAGS)) | |
128 if error_message: | 127 if error_message: |
129 Die(error_message) | 128 Die(error_message) |
130 else: | 129 else: |
131 sys.exit(1) | 130 sys.exit(1) |
132 | 131 |
133 def _PushChange(): | 132 def _PushChange(): |
134 """Pushes changes to the git repository. | 133 """Pushes changes to the git repository. |
135 | 134 |
136 Pushes locals commits from calls to CommitChange to the remote git | 135 Pushes locals commits from calls to CommitChange to the remote git |
137 repository specified by os.pwd. | 136 repository specified by os.pwd. |
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
389 except (OSError, IOError): | 388 except (OSError, IOError): |
390 Warning('Cannot rev %s\n' % ebuild.package, | 389 Warning('Cannot rev %s\n' % ebuild.package, |
391 'Note you will have to go into %s ' | 390 'Note you will have to go into %s ' |
392 'and reset the git repo yourself.' % overlay) | 391 'and reset the git repo yourself.' % overlay) |
393 raise | 392 raise |
394 | 393 |
395 | 394 |
396 if __name__ == '__main__': | 395 if __name__ == '__main__': |
397 main(sys.argv) | 396 main(sys.argv) |
398 | 397 |
OLD | NEW |