blob: e4b1d8b1628b23e0e63cde2c5a2e3e9956fcb486 [file] [log] [blame]
Josip Sokcevic4de5dea2022-03-23 21:15:14 +00001#!/usr/bin/env python3
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
Robert Iannucci4e87f5b2023-07-13 19:51:33 +000013
iannucci@chromium.orgc050a5b2014-03-26 06:18:50 +000014def CMDfreeze(parser, args):
Joanna Wang25410062023-08-10 23:28:44 +000015 """Freeze a branch's changes, excluding unstaged gitlinks changes."""
iannucci@chromium.org97345eb2014-03-13 07:55:15 +000016 parser.parse_args(args)
17 return freeze()
18
19
iannucci@chromium.orgc050a5b2014-03-26 06:18:50 +000020def CMDthaw(parser, args):
iannucci@chromium.org97345eb2014-03-13 07:55:15 +000021 """Returns a frozen branch to the state before it was frozen."""
22 parser.parse_args(args)
23 return thaw()
24
25
sbc@chromium.org013731e2015-02-26 18:28:43 +000026def main(args):
iannucci@chromium.org97345eb2014-03-13 07:55:15 +000027 dispatcher = subcommand.CommandDispatcher(__name__)
sbc@chromium.org013731e2015-02-26 18:28:43 +000028 ret = dispatcher.execute(optparse.OptionParser(), args)
iannucci@chromium.org97345eb2014-03-13 07:55:15 +000029 if ret:
Raul Tambre80ee78e2019-05-06 22:41:05 +000030 print(ret)
sbc@chromium.org013731e2015-02-26 18:28:43 +000031 return 0
iannucci@chromium.org97345eb2014-03-13 07:55:15 +000032
33
iannucci@chromium.orgc050a5b2014-03-26 06:18:50 +000034if __name__ == '__main__':
sbc@chromium.org013731e2015-02-26 18:28:43 +000035 try:
36 sys.exit(main(sys.argv[1:]))
37 except KeyboardInterrupt:
38 sys.stderr.write('interrupted\n')
39 sys.exit(1)