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

Side by Side Diff: git_freezer.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
« clang_format.py ('K') | « git_footers.py ('k') | git_map.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 import sys 6 import sys
7 import optparse 7 import optparse
8 8
9 import subcommand 9 import subcommand
10 10
11 from git_common import freeze, thaw 11 from git_common import freeze, thaw
12 12
13 def CMDfreeze(parser, args): 13 def CMDfreeze(parser, args):
14 """Freeze a branch's changes.""" 14 """Freeze a branch's changes."""
15 parser.parse_args(args) 15 parser.parse_args(args)
16 return freeze() 16 return freeze()
17 17
18 18
19 def CMDthaw(parser, args): 19 def CMDthaw(parser, args):
20 """Returns a frozen branch to the state before it was frozen.""" 20 """Returns a frozen branch to the state before it was frozen."""
21 parser.parse_args(args) 21 parser.parse_args(args)
22 return thaw() 22 return thaw()
23 23
24 24
25 def main(): 25 def main(args):
26 dispatcher = subcommand.CommandDispatcher(__name__) 26 dispatcher = subcommand.CommandDispatcher(__name__)
27 ret = dispatcher.execute(optparse.OptionParser(), sys.argv[1:]) 27 ret = dispatcher.execute(optparse.OptionParser(), args)
28 if ret: 28 if ret:
29 print ret 29 print ret
30 return 0
30 31
31 32
32 if __name__ == '__main__': 33 if __name__ == '__main__':
33 main() 34 try:
35 sys.exit(main(sys.argv[1:]))
36 except KeyboardInterrupt:
37 sys.stderr.write('interrupted\n')
38 sys.exit(1)
OLDNEW
« clang_format.py ('K') | « git_footers.py ('k') | git_map.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698