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 and Gerrit.""" | 8 """A git-command for integrating reviews on Rietveld and Gerrit.""" |
9 | 9 |
10 from __future__ import print_function | 10 from __future__ import print_function |
(...skipping 3187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3198 print('%*s %s' % (alignment, next_item[0], next_item[1])) | 3198 print('%*s %s' % (alignment, next_item[0], next_item[1])) |
3199 | 3199 |
3200 if any(branch == current_branch for branch, _ in proposal): | 3200 if any(branch == current_branch for branch, _ in proposal): |
3201 print('You are currently on a branch \'%s\' which is associated with a ' | 3201 print('You are currently on a branch \'%s\' which is associated with a ' |
3202 'closed codereview issue, so archive cannot proceed. Please ' | 3202 'closed codereview issue, so archive cannot proceed. Please ' |
3203 'checkout another branch and run this command again.' % | 3203 'checkout another branch and run this command again.' % |
3204 current_branch) | 3204 current_branch) |
3205 return 1 | 3205 return 1 |
3206 | 3206 |
3207 if not options.force: | 3207 if not options.force: |
3208 if ask_for_data('\nProceed with deletion (Y/N)? ').lower() != 'y': | 3208 answer = ask_for_data('\nProceed with deletion (Y/n)? ').lower() |
| 3209 if answer not in ('y', ''): |
3209 print('Aborted.') | 3210 print('Aborted.') |
3210 return 1 | 3211 return 1 |
3211 | 3212 |
3212 for branch, tagname in proposal: | 3213 for branch, tagname in proposal: |
3213 RunGit(['tag', tagname, branch]) | 3214 RunGit(['tag', tagname, branch]) |
3214 RunGit(['branch', '-D', branch]) | 3215 RunGit(['branch', '-D', branch]) |
3215 print('\nJob\'s done!') | 3216 print('\nJob\'s done!') |
3216 | 3217 |
3217 return 0 | 3218 return 0 |
3218 | 3219 |
(...skipping 1810 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5029 if __name__ == '__main__': | 5030 if __name__ == '__main__': |
5030 # These affect sys.stdout so do it outside of main() to simplify mocks in | 5031 # These affect sys.stdout so do it outside of main() to simplify mocks in |
5031 # unit testing. | 5032 # unit testing. |
5032 fix_encoding.fix_encoding() | 5033 fix_encoding.fix_encoding() |
5033 setup_color.init() | 5034 setup_color.init() |
5034 try: | 5035 try: |
5035 sys.exit(main(sys.argv[1:])) | 5036 sys.exit(main(sys.argv[1:])) |
5036 except KeyboardInterrupt: | 5037 except KeyboardInterrupt: |
5037 sys.stderr.write('interrupted\n') | 5038 sys.stderr.write('interrupted\n') |
5038 sys.exit(1) | 5039 sys.exit(1) |
OLD | NEW |