blob: 91a4ec0d94d6432331c438212b8982bd303f53b9 [file] [log] [blame]
iannucci@chromium.org97231b52014-03-26 06:54:55 +00001#!/usr/bin/env python
iannucci@chromium.orgc050a5b2014-03-26 06:18:50 +00002# Copyright 2014 The Chromium Authors. All rights reserved.
3# Use of this source code is governed by a BSD-style license that can be
4# found in the LICENSE file.
5
iannucci@chromium.org97345eb2014-03-13 07:55:15 +00006import sys
iannucci@chromium.org97345eb2014-03-13 07:55:15 +00007import optparse
8
9import subcommand
iannucci@chromium.org97345eb2014-03-13 07:55:15 +000010
iannucci@chromium.orgc050a5b2014-03-26 06:18:50 +000011from git_common import freeze, thaw
iannucci@chromium.org97345eb2014-03-13 07:55:15 +000012
iannucci@chromium.orgc050a5b2014-03-26 06:18:50 +000013def CMDfreeze(parser, args):
iannucci@chromium.org97345eb2014-03-13 07:55:15 +000014 """Freeze a branch's changes."""
15 parser.parse_args(args)
16 return freeze()
17
18
iannucci@chromium.orgc050a5b2014-03-26 06:18:50 +000019def CMDthaw(parser, args):
iannucci@chromium.org97345eb2014-03-13 07:55:15 +000020 """Returns a frozen branch to the state before it was frozen."""
21 parser.parse_args(args)
22 return thaw()
23
24
sbc@chromium.org013731e2015-02-26 18:28:43 +000025def main(args):
iannucci@chromium.org97345eb2014-03-13 07:55:15 +000026 dispatcher = subcommand.CommandDispatcher(__name__)
sbc@chromium.org013731e2015-02-26 18:28:43 +000027 ret = dispatcher.execute(optparse.OptionParser(), args)
iannucci@chromium.org97345eb2014-03-13 07:55:15 +000028 if ret:
29 print ret
sbc@chromium.org013731e2015-02-26 18:28:43 +000030 return 0
iannucci@chromium.org97345eb2014-03-13 07:55:15 +000031
32
iannucci@chromium.orgc050a5b2014-03-26 06:18:50 +000033if __name__ == '__main__':
sbc@chromium.org013731e2015-02-26 18:28:43 +000034 try:
35 sys.exit(main(sys.argv[1:]))
36 except KeyboardInterrupt:
37 sys.stderr.write('interrupted\n')
38 sys.exit(1)