| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright 2014 The Chromium Authors. All rights reserved. | 2 # Copyright 2014 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 """Rename the current branch while maintaining correct dependencies.""" | 6 """Rename the current branch while maintaining correct dependencies.""" |
| 7 | 7 |
| 8 import argparse | 8 import argparse |
| 9 import sys | 9 import sys |
| 10 | 10 |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 | 37 |
| 38 # update the downstreams | 38 # update the downstreams |
| 39 for branch, merge in branch_config_map('merge').iteritems(): | 39 for branch, merge in branch_config_map('merge').iteritems(): |
| 40 if merge == 'refs/heads/' + opts.old_name: | 40 if merge == 'refs/heads/' + opts.old_name: |
| 41 # Only care about local branches | 41 # Only care about local branches |
| 42 if branch_config(branch, 'remote') == '.': | 42 if branch_config(branch, 'remote') == '.': |
| 43 set_branch_config(branch, 'merge', 'refs/heads/' + opts.new_name) | 43 set_branch_config(branch, 'merge', 'refs/heads/' + opts.new_name) |
| 44 except subprocess2.CalledProcessError as cpe: | 44 except subprocess2.CalledProcessError as cpe: |
| 45 sys.stderr.write(cpe.stderr) | 45 sys.stderr.write(cpe.stderr) |
| 46 return 1 | 46 return 1 |
| 47 return 0 |
| 47 | 48 |
| 48 | 49 |
| 49 if __name__ == '__main__': # pragma: no cover | 50 if __name__ == '__main__': # pragma: no cover |
| 50 sys.exit(main(sys.argv[1:])) | 51 try: |
| 52 sys.exit(main(sys.argv[1:])) |
| 53 except KeyboardInterrupt: |
| 54 sys.stderr.write('interrupted\n') |
| 55 sys.exit(1) |
| OLD | NEW |