| 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 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) |
| OLD | NEW |