Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(59)

Side by Side Diff: git_rename_branch.py

Issue 955993006: Handle KeyboardInterrupt consistently in python scripts (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools
Patch Set: tweek test expectations Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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)
OLDNEW
« clang_format.py ('K') | « git_rebase_update.py ('k') | git_reparent_branch.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698